﻿if (typeof ($vs10) == "undefined" && typeof (vs10) == "undefined")
{ var $vs10 = window.$vs10 = {}; var vs10 = window.vs10 = {}; vs10.dom = {}; }
else { throw new Error("$vs10 load fail or load again！"); }
if (typeof (vsClass) == "undefined") var vsClass = window.vsClass = {};
$vs10.dom = {}; /**/$vs10.server = {}; /**/$vs10.request = {}; /**/$vs10.response = {}; /**/$vs10.browser = { isIE: (document.all != null) };
$vs10.pager = {}; /**/$vs10.doc = {}; /**/$vs10.parser = {}; /**/$vs10.config = { isDebug: true, rootPath: "/", isOneDesktop: false };
$vs10.designMode = (!String); $vs10.testMode = false;
$vs10.foreach = function (arrInput, itemHandler) {
	arr = [];
	if (arrInput.constructor == Array) { arr = [].concat(arrInput); } else
	{ for (var i = 0, len = arrInput.length; i < len; i++) { arr.push(arrInput[i]); } }
	for (var i = 0, len = arr.length; i < len; i++) { if (itemHandler(arr[i]) === true) break; }
}
$vs10.request.Runer = function () {
	var search = document.location.search;
	if (search == "" || search == "?") return;
	if (search.substr(0, 1) == "?") search = search.substr(1);
	var arr = search.split("&");
	for (var i = 0, count = arr.length; i < count; i++) {
		var paramArr = arr[i].split("="); var n = paramArr[0]; var v = paramArr[1];
		if (n == "Runer") continue;
		this[n] = (this[n] == null)
            ? v : ((this[n].constructor == Array)
                ? this[n].concat([v]) : [this[n], v]);
	}
}; if (!$vs10.designMode) $vs10.request.Runer();
/*Extend of Prototype*/
if (Date.prototype.format == null) Date.prototype.format = function (format) {
	var regs = [/yyyy/g, /MM/g, /dd/g, /HH/g, /mm/g, /ss/g]; var regs2 = [/yy/g, /M/g, /d/g, /H/g, /m/g, /s/g];
	var values = [this.getFullYear(), this.getMonth() + 1, this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds()];
	for (var i = 0; i < 6; i++) { format = format.replace(regs[i], (values[i] > 9) ? values[i] : "0" + values[i]); format = format.replace(regs2[i], values[i]); }
	return format;
}
String.format = function (string, args) {
	var reg, val; for (var i = 0, count = arguments.length - 1; i < count; i++) { reg = new RegExp("[\{]{1}" + i + "[\}]{1}", "g"); val = arguments[i + 1]; if (val == null) break; string = string.replace(reg, val); }
	return string;
}
Number.prototype.formatZero = function (zero) {
	var arr = zero.split("."); var str = "" + this; var next = str.split(".");
	var need = ["0000000000000000000000000000000000", "00000000000000000000000000000000"];
	next[0] = (arr[0].length > next[0].length) ? need[0].substr(0, arr[0].length - next[0].length) + next[0] : next[0];
	if (arr.length > 1) next[1] = (arr[1].length > next[1].length) ? need[1].substr(0, arr[1].length - next[1].length) + next[1] : next[1];
	return next.join(".");
}
/*Static Function with Basic Prototype*/
Object.isLinkAvoid = function (val) {
	try { var a = val.constructor; } catch (e) { return true; } return false;
}
Object.isNull = function (value, replace) {
	return (replace == null) ? (value == null) : ((value == null) ? replace : value);
}
Object.isNullOrEmpty = function (obj, value) {
	return (value == null) ? (obj == null || (typeof (obj) == "number" && isNaN(obj)) || obj === "") : ((obj == null || (typeof (obj) == "number" && isNaN(obj)) || obj === "") ? value : obj);
}
/*oo*/
$vs10.q = $vs10.inherit = function (thisRef, args, baseType) {
	var q = args[0]; if (q == null) q = {}; baseType.apply(thisRef, [q]); return q;
}
$vs10.Copy = function (obj) { var re = {}; for (var prop in obj) { re[prop] = obj[prop] }; return re; }
$vs10.Q = $vs10.initType = function (typeRef) {
	typeRef = (typeRef == null) ? window.vsClass : typeRef; var object = new typeRef();
	if (typeRef.Private1 && typeRef.Private1.TypeName == "vs10.Pager") {
		if (document.VS10PageLoad_OK) window.setTimeout(object.Load, 1); /*为支持UpdatePanel*/else document.OnVS10PageLoad.push(object.Load);
	} else {
		typeRef.Type(); typeRef.Demo = new typeRef(); vs10.baseType = typeRef;
		typeRef.New = function () { var obj = new this(); obj.Init.apply(obj, arguments); delete (obj.Init); return obj; }
	}
}
/*event*/
$vs10.addEvent = function (sender, ev) {
	if (sender["On" + ev]) return; sender["On" + ev] = []; sender["On" + ev + "_End"] = [];
	sender[ev] = function () {
		var evs = sender["On" + ev]; var goOn;
		for (var i = 0, evCount = evs.length; i < evCount; ) {
			if (Object.isLinkAvoid(evs[i]) || typeof (evs[i]) == "undefined") {
				evs.splice(i, 1); evCount--; continue;
			}
			goOn = evs[i].apply(sender, arguments);
			if (goOn === false) { sender[ev + "_End"].apply(sender, arguments); return false; }
			i++;
		}
		sender[ev + "_End"].apply(sender, arguments);
		return true;
	}
	sender[ev + "_End"] = function () {
		var evs = sender["On" + ev + "_End"]; var goOn;
		for (var i = 0, evCount = evs.length; i < evCount; ) {
			if (Object.isLinkAvoid(evs[i]) || typeof (evs[i]) == "undefined") {
				evs.splice(i, 1); evCount--; continue;
			}
			goOn = evs[i].apply(sender, arguments);
			if (goOn === false) return false;
			i++;
		}
		return true;
	}
}
$vs10.addEvent(document, "VS10PageLoad");
document.OnVS10PageLoad_End.push(function () { document.VS10PageLoad_OK = true; });
$vs10.browser.getWindow = function (docElement) {
	var doc = docElement.ownerDocument || docElement.document || docElement;
	return doc.defaultView || doc.parentWindow;
}
$vs10.addHandler = function (element, eventName, handler) {
	if (!element._events) element._events = {};
	var eventCache = element._events[eventName];
	if (!eventCache) {
		element._events[eventName] = eventCache = [];
	}
	var browserHandler;
	if (element.attachEvent) {
		browserHandler = function () {
			var e = {};
			try { e = $vs10.browser.getWindow(this).event; } catch (ex) { }
			return handler.call(element, e);
		}
		element.attachEvent("on" + eventName, browserHandler);
	} else if (element.addEventListener) {
		browserHandler = function (e) {
			return handler.call(element, e);
		}
		element.addEventListener(eventName, browserHandler, false);
	}
	eventCache[eventCache.length] = { handler: handler, browserHandler: browserHandler }
}
$vs10.removeHandler = function (element, eventName, handler) {
	var cache = element._events[eventName];
	var browserHandler;
	if (!(cache instanceof Array)) throw new Error("No Handler created by $vs10.addHandler");
	for (var i = 0, l = cache.length; i < l; i++) {
		if (cache[i].handler === handler) {
			browserHandler = cache[i].browserHandler;
			break;
		}
	}
	if (element.removeEventListener) {
		element.removeEventListener(eventName, browserHandler, false);
	}
	else if (element.detachEvent) {
		element.detachEvent('on' + eventName, browserHandler);
	}
	cache.splice(i, 1);
}
//Page Loader
$vs10.addHandler(window, "load", function () {
	window.setTimeout(document.VS10PageLoad, 0);
});
$vs10.server.mapPath = function (rootTagPath) {
	return rootTagPath.replace(new RegExp("^~\\/"), $vs10.config.rootPath);
}
if (!window.XMLHttpRequest) window.XMLHttpRequest = function () {
	var b = ["Mxsml2.XMLHTTP.3.0", "Msxml2.XMLHTTP"];
	for (var a = 0, c = b.length; a < c; a++) try { return new ActiveXObject(b[a]) } catch (d) { }
	return null
};
$vs10.browser.xmlHttp = null;
$vs10.browser.getData = function (path, exHandler) {
	if (xmlHttp == null) xmlHttp = new window.XMLHttpRequest();
	try {
		xmlHttp.open("get", path, false);
		xmlHttp.setRequestHeader('If-Modified-Since', '0');
		xmlHttp.send(null);
	} catch (e) { return null; }
	var status = xmlHttp.status;
	if (status != "200") {
		if (status == 304 || status == 400) { return null; }
		var errorMsg = path + String.format("\r\nError Number:{0}\r\n========================\r\n", xmlHttp.status) + xmlHttp.responseText;
		if (exHandler) exHandler(errorMsg);
		return null;
	}
	var text = xmlHttp.responseText;
	return text;
}
$vs10.browser.getDataObject = function (jsPath) {
	var js = $vs10.browser.getData(jsPath, function (msg) { if (window.MasterPage) window.MasterPage.SetStatus(msg); });
	try { return window.eval("(" + js + ")"); } catch (e) { return null; }
}
vsClass = vs10.Object = function () {
	var q = arguments[0]; if (q == null) q = {}; var Me = this;
	var Static = q.Static = this.constructor; if (Static.Private == null) {
		Static.Private = new function () {
			var S = this; var uniqueIndex = 0; S.NewObject = function () { var index = uniqueIndex; uniqueIndex++; return index; }
		}
		Static.Q = q; Static.Inited = true; q.Type = Static.Type = function () {
			for (var prop in Me) { if (prop == "Init") continue; Static.Type.prototype[prop] = Me[prop]; }
		}
	}
	Me.Bind = q.Bind = {}; Me.UniqueIndex = q.UniqueIndex = Static.Private.NewObject(Me);
	Me.Config = q.Config = {}; q.Info = {}; q.State = {}; q.Inits = {}; q.Handlers = {}; q.Events = {}; q.Acts = {};
	Me.Enums = q.Enums = {}; Me.Nodes = q.Nodes = {}; q.Indexer = {}; q.Data = {};
	q.Demos = {};
	q.a__Attribute0 = function () { }; Me.Init = q.Init = q.Acts.Init = function () { }; q.AttachEvent = function () { }
	q.Destroy = function () {
		for (prop in q) { delete (q[prop]); } for (prop in Me) { delete (Me[prop]); }
		if (CollectGarbage) { CollectGarbage(); window.setTimeout("try{CollectGarbage();}catch(e){}", 1); }
	}
	Me.toString = function () { return $vs10.parser.parserOne(this); }
}; $vs10.initType(vsClass);
vsClass.$new = function () {
	/// <returns type="vs10.Object.Type"></returns>
	return this.New.apply(this, arguments);
}
vsClass = vs10.Control = function () {
	var $ = $vs10;
	var q = $vs10.inherit(this, arguments, vs10.Object);
	if ($vs10.designMode) q = vs10.Object.Q;
	if ($vs10.designMode) alert("$vs10.designMode work fail!");    //test $vs10.designMode
	var acts = q.Acts, nodes = q.Nodes, info = q.Info, dom = $vs10.dom;
	var Me = this;
	q.$get = function (id) { return document.getElementById(id); }
	q.Request = $vs10.request; q.Response = $.response; q.Server = $vs10.server; q.Parser = $vs10.parser; q.VsConfig = $vs10.Copy($vs10.config);
	q.Controls = []; Me.Parent = q.Parent = null;
	nodes.TopNode = dom.Node; info.HTMLNode = document.getElementsByTagName("HTML")[0];
	var classList = [];
	acts.AddClass = function (el, className) {
		///<summary>对指定节点添加class</summary>
		var oldClassName = el.className;
		if ($vs10.testMode) { var info = el.innerText; classList.push(((info && info != " ") ? "/*" + info.substr(0, 10) + "*/\r\n" : "") + "." + className + "{}"); }
		if (Object.isNullOrEmpty(oldClassName, true) === true)
			el.className = className;
		else if ((" " + oldClassName + " ").indexOf(" " + className + " ") == -1)
			el.className += " " + className;
	}
	acts.InheritSkin = function (skinHeader) {
		///<summary>对q.Nodes所有节点绑定class，并特意绑定TopNode节点</summary>
		var className; var arr; var header = skinHeader + "_";
		acts.AddClass(nodes.TopNode, skinHeader);
		for (var prop in q.Nodes) {
			var node = q.Nodes[prop];
			if (node.nodeType == dom.Node.EnumNodeType.Element) {
				className = prop;
				acts.AddClass(node, header + className);
			}
			if (node.constructor == Array) {
				arr = node;
				for (var i = 0, count = arr.length; i < count; i++) {
					if (arr[i] && arr[i].nodeType == dom.Node.EnumNodeType.Element) {
						className = prop + "_" + i;
						acts.AddClass(arr[i], header + prop);
						acts.AddClass(arr[i], header + className);
					}
				}
			}
		}
		if ($vs10.testMode) { q.$get("vs10_Control_ClassView").innerText += "\r\n/*====*/\r\n" + classList.join("\r\n"); classList = []; }
	}
	acts.SetOpacity = function (el, opacityPercent) {
		if (opacityPercent < 100) {
			el.style.filter = "alpha(opacity=" + opacityPercent + ")"; el.style.opacity = opacityPercent / 100;
		} else {
			el.style.filter = null; el.style.opacity = null;
		}
	}
	acts.GetPointerX = function (event) {
		///<summary>读取当前事件x坐标值</summary>
		return event.pageX || (event.clientX + (document.documentElement.scrollLeft || info.HTMLNode.scrollLeft));
	}
	acts.GetPointerY = function (event) {
		///<summary>读取当前事件y坐标值</summary>
		return event.pageY || (event.clientY + (document.documentElement.scrollTop || info.HTMLNode.scrollTop));
	}
	acts.GetPosTop = function (node) {
		///<summary>逐级向上，统计某节点的上坐标值</summary>
		var top = 0, nextParent = node;
		if (node.style && node.style.position == 'absolute' && ('' + node.style.topcenter) == 'true') {
			node.style.display = "inline-block";
			var centerTop = ((info.HTMLNode.offsetHeight - node.offsetHeight) / 2) + (document.documentElement.scrollTop || info.HTMLNode.scrollTop);
			centerTop = centerTop < 0 ? 0 : centerTop;
			node.style.top = centerTop + "px";
			node.style.topcenter = 'keep';
			node.style.display = "none";
		}
		while (nextParent != null) {
			if (nextParent.style && nextParent.style.position == 'absolute' && !isNaN(parseInt(nextParent.style.top))) {
				top += parseInt(nextParent.style.top); break;
			}
			top += isNaN(nextParent.offsetTop) ? 0 : nextParent.offsetTop;
			nextParent = nextParent.parentNode;
		}
		return top;
	}
	acts.GetPosLeft = function (node) {
		///<summary>逐级向上，统计某节点的左坐标值</summary>
		var left = 0, nextParent = node;
		if (node.style && node.style.position == 'absolute' && ('' + node.style.leftcenter) == 'true') {
			node.style.display = "inline-block";
			var centerLeft = ((info.HTMLNode.offsetWidth - node.offsetWidth) / 2) + (document.documentElement.scrollLeft || info.HTMLNode.scrollLeft);
			node.style.left = centerLeft + "px";
			node.style.leftcenter = 'keep'
			node.style.display = "none";
		}
		while (nextParent != null) {
			if (nextParent.style && nextParent.style.position == 'absolute' && !isNaN(parseInt(nextParent.style.left))) {
				left += parseInt(nextParent.style.left); break;
			}
			left += isNaN(nextParent.offsetLeft) ? 0 : nextParent.offsetLeft;
			nextParent = nextParent.parentNode;
		}
		return left;
	}
	acts.GetHearTop = function (node) { var v = parseInt(node.style.marginTop); return isNaN(v) ? 0 : v; }
	acts.GetHearLeft = function (node) { var v = parseInt(node.style.marginLeft); return isNaN(v) ? 0 : v; }
}; $vs10.initType(vsClass);
vsClass.$new = function () {
	///<returns type="vs10.Control.Type"></returns>
	return this.New.apply(this, arguments);
}
vsClass = vs10.Pager = function () {
	var $ = $vs10;
	var q = $vs10.inherit(this, arguments, vs10.Control);
	if (!q.Static.Private1) {
		q.Static.Private1 = new function () {
			var S = this;
			S.TypeName = "vs10.Pager";
		}
	}
	this.Load = q.Load = function () { }
}; $vs10.initType(vsClass);
vsClass.$new = function () {
	/// <returns type="vs10.Pager.Type"></returns>
	return this.New.apply(this, arguments);
}
//DOM
with ($vs10) {
	dom.A = dom.Button = dom.CheckInput = dom.Div = dom.Fieldset = dom.Form = dom.Iframe = dom.Image = dom.ImageInput
    = dom.Input = dom.Label = dom.Legend = dom.Marquee = dom.Node = dom.Option = dom.P = dom.Pre = dom.Select
    = dom.Span = dom.Style = dom.Table = dom.TBody = dom.TD = dom.Textarea = dom.TFood = dom.THead = dom.TR = { style: {},
    	EnumAlign: { center: "center", justify: "justify", left: "left", right: "right", Default: "left" },
    	EnumNodeType: { Element: 1, Text: 3 },
    	EnumReadyState: { uninitialized: "uninitialized", loading: "loading"
            , loaded: "loaded", interactive: "interactive", complete: "complete"
    	},
    	EnumTarget: { Blank: "_blank", Self: "_self", Parent: "_parent", Default: "" },
    	EnumApplyElementPosition: { Outside: "outside", Inside: "inside"}
    };
	dom.DoNothingHref = "javascript:void(0);";
	dom.BlankText = "&nbsp;";
	dom.Space = function (n) { var s = []; for (var i = 0; i < n; i++) s.push(dom.BlankText); return s.join(""); }
	dom.Events = ["onabort", "onafterprint", "onafterupdate", "onbeforecopy", "onbeforecut", "onbeforeeditfocus"
    , "onbeforepaste", "onbeforeprint", "onbeforeunload", "onbeforeupdate", "onblur", "onbounce"
    , "oncellchange", "onchange", "onclick", "oncontextmenu", "oncopy", "oncut"
    , "ondataavailable", "ondatasetchanged", "ondatasetcomplete", "ondblclick", "ondrag", "ondragend"
    , "ondragenter", "ondragleave", "ondragover", "ondragstart", "ondrop", "onerror"
    , "onerrorupdate", "onfilterchange", "onfinish", "onfocus", "onhelp", "onkeydown"
    , "onkeypress", "onkeyup", "onload", "onlosecapture", "onmousedown", "onmousemove"
    , "onmouseout", "onmouseover", "onmouseup", "onpaste", "onpropertychange", "onreadystatechange"
    , "onreset", "onresize", "onrowenter", "onrowexit", "onrowsdelete", "onrowsinserted"
    , "onscroll", "onselect", "onselectstart", "onstart", "onstop", "onsubmit", "onunload"]
	for (var domEventIndex = 0, domEventCount = dom.Events.length; domEventIndex < domEventCount; domEventIndex++) {
		var eventName = dom.Events[domEventIndex]; dom.Events[eventName] = eventName.substring(2);
	}
}
with ($vs10) {
	doc.$get = function (id) { return document.getElementById(id); }
	with (doc) {
		doc.GetNode = doc.GetDiv = doc.GetFieldSet = doc.GetLegend
         = doc.GetP = doc.GetPre = doc.GetSpan = function (id) {///<returns type="dom.Node.Type"></returns>
         	return $get(id);
         }
		doc.GetA = doc.GetALink = function (id) {///<returns type="dom.A.Type"></returns>
			return $get(id);
		}
		doc.GetForm = function (id) {///<returns type="vs10.dom.Form.Type"></returns>
			return $get(id);
		}
		doc.GetIframe = function (id) {///<returns type="vs10.dom.Iframe.Type"></returns>
			return $get(id);
		}
		doc.GetImage = function (id) {///<returns type="vs10.dom.Image.Type"></returns>
			return $get(id);
		}
		doc.GetMarquee = function (id) {///<returns type="vs10.dom.Marquee.Type"></returns>
			return $get(id);
		}
		doc.GetOption = function (id) {///<returns type="vs10.dom.Option.Type"></returns>
			return $get(id);
		}
		doc.GetSelect = function (id) {///<returns type="vs10.dom.Select.Type"></returns>
			return $get(id);
		}
		doc.GetTable = function (id) {///<returns type="vs10.dom.Table.Type"></returns>
			return $get(id);
		}
		doc.GetTBody = function (id) {///<returns type="vs10.dom.TBody.Type"></returns>
			return $get(id);
		}
		doc.GetTR = function (id) {///<returns type="vs10.dom.TR.Type"></returns>
			return $get(id);
		}
		doc.GetTD = function (id) {///<returns type="vs10.dom.TD.Type"></returns>
			return $get(id);
		}
		doc.GetButton = function (id) {///<returns type="vs10.dom.Button.Type"></returns>
			return $get(id);
		}
		doc.GetLabel = function (id) {///<returns type="vs10.dom.Label.Type"></returns>
			return $get(id);
		}
		doc.GetCheckBoxInput = doc.GetRadioInput = doc.GetCheckInput = function (id) {///<returns type="vs10.dom.CheckInput.Type"></returns>
			return $get(id);
		}
		doc.GetFileInput = function (id) {///<returns type="vs10.dom.FileInput.Type"></returns>
			return $get(id);
		}
		doc.GetHiddenInput = doc.GetInput = doc.GetPasswordInput = doc.GetResetInput
         = doc.GetSubmitInput = doc.GetTextInput = function (id) {///<returns type="vs10.dom.Input.Type"></returns>
         	return $get(id);
         }
		doc.GetImageInput = function (id) {///<returns type="vs10.dom.ImageInput.Type"></returns>
			return $get(id);
		}
	}
}
//==================
with ($vs10) {
	dom.Blank = "&nbsp;";
	dom.NewA = dom.NewALink = function (href, target, innerHTML, isInlineBlock) {
		///<returns type="$vs10.dom.A.Type"></returns>
		var link = document.createElement("A");
		if (!String) link = dom.A;
		link.href = Object.isNullOrEmpty(href, "javascript:void(0)");
		link.target = Object.isNull(target, "");
		link.innerHTML = Object.isNull(innerHTML, "");
		if (isInlineBlock == true) link.style.display = "inline-block";
		return link;
	}
	dom.NewDiv = function (innerHTML) {
		///<param name="innerHTML">默认为nbsp;</param>
		///<returns type="$vs10.dom.Node.Type"></returns>
		var div = document.createElement("DIV");
		if (!String) div = dom.Node;
		div.innerHTML = Object.isNull(innerHTML, "");
		return div;
	}
	dom.NewHR = function () {
		///<param name="innerHTML">默认为nbsp;</param>
		///<returns type="$vs10.dom.Node.Type"></returns>
		var hr = document.createElement("HR");
		return hr;
	}
	dom.NewFieldset = function (title) {
		///<returns type="$vs10.dom.Node.Type"></returns>
		var fieldset = document.createElement("FIELDSET");
		if (title != null) {
			var legend = document.createElement("LEGEND");
			legend.innerHTML = title;
			fieldset.appendChild(legend);
		}
		return fieldset;
	}
	dom.NewForm = function (action, method, formEncoding) {
		///<returns type="$vs10.dom.Form.Type"></returns>
		var form = document.createElement("FORM");
		if (!String) form = dom.Form;
		form.action = Object.isNull(action, "");
		form.method = Object.isNullOrEmpty(method, dom.Form.EnumMethod.Get);
		form.encoding = Object.isNull(formEncoding, dom.Form.EnumFormEncoding.Default);
		return form;
	}
	dom.BlankUrl = "about:blank";
	dom.NewIframe = function (src, name) {
		///<returns type="$vs10.dom.Iframe.Type"></returns>
		name = Object.isNullOrEmpty(name, "");
		var iframe = null;
		if ($vs10.browser.isIE) {
			try { iframe = document.createElement(String.format("<iframe id='{0}' name='{0}'></iframe>", name)); } catch (e) { }
		}
		if (iframe == null) {
			iframe = document.createElement("IFRAME");
		}
		if (!String) iframe = dom.Iframe;
		if (src != null) iframe.src = src;
		iframe.id = name;
		iframe.name = name;
		return iframe;
	}
	dom.NewImage = dom.NewImg = function (src) {
		///<returns type="$vs10.dom.Image.Type"></returns>
		var image = new Image();
		if (src != null) {
			//		if(src.toUpperCase().indexOf(".PNG") > 0 && Sys.Browser.InternetExplorer){
			//			//PNG图片透明处理
			//		}
			image.src = src;
		}
		return image;
	}
	dom.NewLegend = function (title) {
		///<returns type="$vs10.dom.Node.Type"></returns>
		var legend = document.createElement("LEGEND");
		legend.innerHTML = Object.isNullOrEmpty(title, "");
		return legend;
	}
	dom.NewMarquee = function () {
		///<returns type="$vs10.dom.Marquee.Type"></returns>
		var marquee = document.createElement("Marquee");
		return marquee;
	}
	dom.NewOption = function (text, value) {
		///<returns type="$vs10.dom.Option.Type"></returns>
		var option = document.createElement("option");
		option.text = text;
		option.value = Object.isNull(value, text);
		return option;
	}
	dom.NewP = function (innerHTML) {
		///<returns type="$vs10.dom.Node.Type"></returns>
		var p = document.createElement("P");
		p.innerHTML = Object.isNull(innerHTML, "");
		return p;
	}
	dom.NewPre = function (innerHTML) {
		///<returns type="$vs10.dom.Node.Type"></returns>
		var pre = document.createElement("PRE");
		pre.innerHTML = Object.isNull(innerHTML, "");
		return pre;
	}
	dom.NewSelect = function (isMulti) {
		///<returns type="$vs10.dom.Select.Type"></returns>
		var select = document.createElement("SELECT");
		if (!String) select = dom.Select;
		select.multiple = isMulti;
		return select;
	}
	dom.NewSpan = function (innerHTML, isInlineBlock) {
		///<returns type="$vs10.dom.Node.Type"></returns>
		var span = document.createElement("SPAN");
		if (isInlineBlock == true) span.style.display = "inline-block";
		span.innerHTML = Object.isNull(innerHTML, "");
		return span;
	}
	dom.NewUL = function () {
		/// <returns type="$vs10.dom.Node.Type"></returns>
		var ul = document.createElement("UL");
		return ul;
	}
	dom.NewOL = function () {
		/// <returns type="$vs10.dom.Node.Type"></returns>
		var ol = document.createElement("OL");
		return ol;
	}
	dom.NewLI = function (innerHTML) {
		/// <returns type="$vs10.dom.Node.Type"></returns>
		var li = document.createElement("LI");
		li.innerHTML = Object.isNull(innerHTML, "");
		return li;
	}
	dom.NewTable = function () {
		///<returns type="$vs10.dom.Table.Type"></returns>
		var table = document.createElement("table");
		if (!String) table = dom.Table;
		table.border = 0;
		table.cellPadding = 0;
		table.cellSpacing = 0;
		return table;
	}
	dom.NewTBody = function (table) {
		///<returns type="$vs10.dom.TBody.Type"></returns>
		var tbody = document.createElement("TBody");
		if (table) table.appendChild(tbody);
		return tbody;
	}
	dom.NewTHead = function (table) {
		///<returns type="$vs10.dom.THead.Type"></returns>
		var thead = document.createElement("THead");
		if (table) table.appendChild(thead);
		return thead;
	}
	dom.NewTFoot = function (table) {
		///<returns type="$vs10.dom.TFoot.Type"></returns>
		var tfoot = document.createElement("TFoot");
		if (table) table.appendChild(tfoot);
		return tfoot;
	}
	dom.NewTR = dom.NewRowOfTable = function (tableOrTBody, rowIndex) {
		///<returns type="$vs10.dom.TR.Type"></returns>
		if (!String) tableOrTBody = dom.TBody;
		var tr = tableOrTBody.insertRow(Object.isNull(rowIndex, -1));
		return tr;
	}
	dom.NewTD = dom.NewCellOfTable = function (tr, cellIndex, text) {
		///<returns type="$vs10.dom.TD.Type"></returns>
		if (!String) tr = dom.TR;
		var td = tr.insertCell(Object.isNull(cellIndex, -1));
		td.innerHTML = Object.isNull(text, "");
		return td;
	}
	dom.NewTH = dom.NewHeadCellOfTable = function (tr, cellIndex, text) {
		///<returns type="$vs10.dom.TD.Type"></returns>
		if (!String) tr = dom.TR;
		var th = document.createElement("TH");
		th.innerHTML = Object.isNull(text, "");
		var td = tr.insertCell(Object.isNull(cellIndex, -1));
		tr.replaceChild(th, td);
		return th;
	}
	//===============
	dom.NewButton = function (innerHTML) {
		///<returns type="$vs10.dom.Button.Type"></returns>
		var button = document.createElement("Button");
		button.innerHTML = Object.isNull(innerHTML, "");
		return button;
	}
	//===============
	dom.NewLabel = function (text, htmlFor) {
		///<returns type="$vs10.dom.Label.Type"></returns>
		var label = document.createElement("Label");
		if (!String) label = dom.Label;
		label.innerHTML = text;
		label.htmlFor = htmlFor;
		return label;
	}
	dom.NewCheckBoxInput = function (name, value) {
		///<returns type="$vs10.dom.CheckInput.Type"></returns>
		var checkbox = null;
		if ($vs10.browser.isIE) {
			try { checkbox = document.createElement(String.format("<input type='checkbox' name='{0}' />", name)); } catch (e) { }
		}
		if (checkbox == null) {
			checkbox = document.createElement("input");
			checkbox.type = "checkbox";
			checkbox.name = name;
		}
		if (!String) checkbox = dom.CheckInput;
		checkbox.value = Object.isNull(value, "");
		checkbox.id = dom.CheckInput.Static.NewID();
		return checkbox;
	}
	dom.NewRadioInput = function (name, value) {
		///<returns type="$vs10.dom.CheckInput.Type"></returns>
		var radio = null;
		if ($vs10.browser.isIE) {
			try {
				radio = document.createElement(String.format("<input type='radio' name='{0}' />", name));
			} catch (e) { }
		}
		if (radio == null) {
			radio = document.createElement("input");
			radio.type = "radio";
			radio.name = name;
		}
		if (!String) radio = dom.CheckInput;
		radio.value = Object.isNull(value, "");
		radio.id = dom.CheckInput.Static.NewID();
		return radio;
	}
	dom.NewFileInput = function (idAndname, value) {
		///<returns type="$vs10.dom.Input.Type"></returns>
		var input = null;
		if ($vs10.browser.isIE) {
			try { input = document.createElement(String.format("<input type='file' id='{0}' name='{0}' />", idAndname)); } catch (e) { }
		}
		if (input == null) {
			input = document.createElement("input");
			input.type = "file";
			input.name = idAndname;
			input.id = idAndname;
		}
		if (!String) input = dom.Input;
		input.value = Object.isNull(value, "");
		return input;
	}
	dom.NewButtonInput = function (idAndname, value) {
		///<returns type="$vs10.dom.Input.Type"></returns>
		var input = null;
		if ($vs10.browser.isIE) {
			try { input = document.createElement(String.format("<input type='button' id='{0}' name='{0}' />", idAndname)); } catch (e) { }
		}
		if (input == null) {
			input = document.createElement("input");
			input.type = "button";
			input.name = idAndname;
			input.id = idAndname;
		}
		if (!String) input = dom.Input;
		input.value = Object.isNull(value, "");
		return input;
	}
	dom.NewHiddenInput = function (idAndname, value) {
		///<returns type="$vs10.dom.Input.Type"></returns>
		var input = null;
		if ($vs10.browser.isIE) {
			try { input = document.createElement(String.format("<input type='hidden' id='{0}' name='{0}' />", idAndname)); } catch (e) { }
		}
		if (input == null) {
			input = document.createElement("input");
			input.type = "hidden";
			input.name = idAndname;
			input.id = idAndname;
		}
		input.value = Object.isNull(value, "");
		return input;
	}
	dom.NewImageInput = function (idAndname, value, src) {
		///<returns type="$vs10.dom.ImageInput.Type"></returns>
		var image = null;
		if ($vs10.browser.isIE) {
			try { image = document.createElement(String.format("<input type='image' id='{0}' name='{0}' />", idAndname)); } catch (e) { }
		}
		if (image == null) {
			image = document.createElement("input");
			image.type = "image";
			image.name = idAndname;
			image.id = idAndname;
		}
		if (!String) image = dom.ImageInput;
		image.value = Object.isNull(value, "");
		image.src = src;
		return image;
	}
	dom.NewPasswordInput = function (idAndname, value) {
		///<returns type="$vs10.dom.Input.Type"></returns>
		var input = null;
		if ($vs10.browser.isIE) {
			try { input = document.createElement(String.format("<input type='password' id='{0}' name='{0}' />", idAndname)); } catch (e) { }
		}
		if (input == null) {
			input = document.createElement("input");
			input.type = "password";
			input.name = idAndname;
			input.id = idAndname;
		}
		input.value = Object.isNull(value, "");
		return input;
	}
	dom.NewResetInput = function (idAndname, value) {
		///<returns type="$vs10.dom.Input.Type"></returns>
		var input = null;
		if ($vs10.browser.isIE) {
			try { input = document.createElement(String.format("<input type='reset' id='{0}' name='{0}' />", idAndname)); } catch (e) { }
		}
		if (input == null) {
			input = document.createElement("input");
			input.type = "reset";
			input.name = idAndname;
			input.id = idAndname;
		}
		input.value = Object.isNull(value, "");
		return input;
	}
	dom.NewSubmitInput = function (idAndname, value) {
		///<returns type="$vs10.dom.Input.Type"></returns>
		var input = null;
		if ($vs10.browser.isIE) {
			try { input = document.createElement(String.format("<input type='submit' id='{0}' name='{0}' />", idAndname)); } catch (e) { }
		}
		if (input == null) {
			input = document.createElement("input");
			input.type = "submit";
			input.name = idAndname;
			input.id = idAndname;
		}
		input.value = Object.isNull(value, "");
		return input;
	}
	dom.NewSubmitInputWithValue = function (value) {
		///<returns type="$vs10.dom.Input.Type"></returns>
		var input = null;
		if ($vs10.browser.isIE) {
			try { input = document.createElement("<input type='submit' />"); } catch (e) { }
		}
		if (input == null) {
			input = document.createElement("input");
			input.type = "submit";
		}
		input.value = Object.isNull(value, "");
		return input;
	}
	dom.NewTextInput = function (idAndname, value) {
		///<returns type="$vs10.dom.Input.Type"></returns>
		var input = null;
		if ($vs10.browser.isIE) {
			try { input = document.createElement(String.format("<input type='text' id='{0}' name='{0}' />", idAndname)); } catch (e) { }
		}
		if (input == null) {
			input = document.createElement("input");
			input.type = "text";
			input.name = idAndname;
			input.id = idAndname;
		}
		input.value = Object.isNull(value, "");
		return input;
	}
	dom.NewTextarea = function (idAndname, value) {
		///<returns type="$vs10.dom.Input.Type"></returns>
		var textarea;
		textarea = document.createElement("textarea");
		textarea.name = idAndname;
		textarea.id = idAndname;
		textarea.value = Object.isNull(value, "");
		return textarea;
	}
	dom.Events = ["onabort", "onafterprint", "onafterupdate"
    , "onbeforecopy", "onbeforecut", "onbeforeeditfocus"
    , "onbeforepaste", "onbeforeprint", "onbeforeunload"
    , "onbeforeupdate", "onblur", "onbounce"
    , "oncellchange", "onchange", "onclick"
    , "oncontextmenu", "oncopy", "oncut"
    , "ondataavailable", "ondatasetchanged", "ondatasetcomplete"
    , "ondblclick", "ondrag", "ondragend"
    , "ondragenter", "ondragleave", "ondragover"
    , "ondragstart", "ondrop", "onerror"
    , "onerrorupdate", "onfilterchange", "onfinish"
    , "onfocus", "onhelp", "onkeydown"
    , "onkeypress", "onkeyup", "onload"
    , "onlosecapture", "onmousedown", "onmousemove"
    , "onmouseout", "onmouseover", "onmouseup"
    , "onpaste", "onpropertychange", "onreadystatechange"
    , "onreset", "onresize", "onrowenter"
    , "onrowexit", "onrowsdelete", "onrowsinserted"
    , "onscroll", "onselect", "onselectstart"
    , "onstart", "onstop", "onsubmit"
    , "onunload"]
	for (var domEventIndex = 0, domEventCount = dom.Events.length; domEventIndex < domEventCount; domEventIndex++) {
		var eventName = dom.Events[domEventIndex];
		dom.Events[eventName] = eventName.substring(2);
	}
}

(function () {
    var m = document.uniqueID && document.compatMode && document.execCommand; // && !window.XMLHttpRequest
    try {
        if (!!m) {
            m("BackgroundImageCache", false, true)
        }
    } catch (e) { };
})();
if (typeof (HTMLElement) != "undefined" && !window.opera) {
    if (HTMLElement.prototype["__defineGetter__"] != null) {
        HTMLElement.prototype.__defineGetter__("canHaveChildren", function () {
            switch (this.tagName.toLowerCase()) {
                case "area": case "base": case "basefont":
                case "col": case "frame": case "hr":
                case "img": case "br": case "input":
                case "link": case "meta": case "isindex":
                case "param": return false;
            }
            return true;
        });
        HTMLElement.prototype.__defineGetter__("innerText", function () {
            return this.textContent;
        });
        HTMLElement.prototype.__defineSetter__("innerText", function (text) {
            this.textContent = text;
        });
        HTMLElement.prototype.__defineGetter__("className", function () {
            return this.getAttribute("class")
        });
        HTMLElement.prototype.__defineSetter__("className", function (className) {
            this.setAttribute("class", className)
        });
        HTMLElement.prototype.__defineGetter__("outerHTML", function () {
            var a = this.attributes, str = "<" + this.tagName, i = 0;
            for (; i < a.length; i++)
                if (a[i].specified) str += " " + a[i].name + '="' + a[i].value + '"';
            if (!this.canHaveChildren) return str + " />";
            return str + ">" + this.innerHTML + "</" + this.tagName + ">";
        });
        HTMLElement.prototype.__defineGetter__("children", function () {
            for (var a = [], j = 0, n, i = 0; i < this.childNodes.length; i++) {
                n = this.childNodes[i];
                if (n.nodeType == 1) {
                    a.push(n);
                    if (n.name) {
                        if (!a[n.name]) a[n.name] = [];
                        a[n.name].push(n);
                    }
                    if (n.id) a[n.id] = n;
                }
            }
            return a;
        });
    }
    if (!HTMLElement.prototype.insertAdjacentHTML)
        HTMLElement.prototype.insertAdjacentHTML = function (where, html) {
            var e = this.ownerDocument.createRange();
            e.setStartBefore(this);
            e = e.createContextualFragment(html);
            switch (where) {
                case 'beforeBegin': this.parentNode.insertBefore(e, this); break;
                case 'afterBegin': this.insertBefore(e, this.firstChild); break;
                case 'beforeEnd': this.appendChild(e); break;
                case 'afterEnd':
                    if (!this.nextSibling) this.parentNode.appendChild(e);
                    else this.parentNode.insertBefore(e, this.nextSibling);
                    break;
            }
        };
    if (!HTMLElement.prototype.swapNode)
        HTMLElement.prototype.swapNode = function (node) {
            var nextSibling = this.nextSibling;
            var parentNode = this.parentNode;
            node.parentNode.replaceChild(this, node);
            parentNode.insertBefore(node, nextSibling);
        }
    if (!HTMLElement.prototype.removeNode)
        HTMLElement.prototype.removeNode = function (removeChild) {
            if (removeChild) this.innerHTML = "";
            var parentNode = this.parentNode;
            this.parentNode.removeChild(this);
        }
}

try {
    if (window.Event && Event.prototype.__defineSetter__) {
        Event.prototype.__defineSetter__("returnValue", function (b) {
            if (!b) this.preventDefault();
            return b;
        });
        Event.prototype.__defineSetter__("cancelBubble", function (b) {
            if (b) this.stopPropagation();
            return b;
        });
        Event.prototype.__defineGetter__("srcElement", function () {
            var node = this.target;
            while (node.nodeType != 1) node = node.parentNode;
            return node;
        });
        Event.prototype.__defineGetter__("fromElement", function () {
            var node;
            if (this.type == "mouseover")
                node = this.relatedTarget;
            else if (this.type == "mouseout")
                node = this.target;
            if (!node) return;
            while (node.nodeType != 1) node = node.parentNode;
            return node;
        });
        Event.prototype.__defineGetter__("toElement", function () {
            var node;
            if (this.type == "mouseout")
                node = this.relatedTarget;
            else if (this.type == "mouseover")
                node = this.target;
            if (!node) return;
            while (node.nodeType != 1) node = node.parentNode;
            return node;
        });
        Event.prototype.__defineGetter__("offsetX", function () {
            return this.layerX;
        });
        Event.prototype.__defineGetter__("offsetY", function () {
            return this.layerY;
        });
    }
} catch (e) { }
if (window.Node) {
    Node.prototype.replaceNode = function (Node) {
        this.parentNode.replaceChild(Node, this);
    }
    Node.prototype.removeNode = function (removeChildren) {
        if (removeChildren) this.innerHTML = "";
        var parentNode = this.parentNode;
        this.parentNode.removeChild(this);
    }
    Node.prototype.swapNode = function (Node) {
        var nextSibling = this.nextSibling;
        var parentNode = this.parentNode;
        node.parentNode.replaceChild(this, Node);
        parentNode.insertBefore(node, nextSibling);
    }
}
if (window.HTMLElement && HTMLElement.prototype.__defineGetter__) {
    HTMLElement.prototype.__defineGetter__("all", function () {
        var a = this.getElementsByTagName("*");
        var node = this;
        a.tags = function (sTagName) {
            return node.getElementsByTagName(sTagName);
        }
        return a;
    });
    HTMLElement.prototype.__defineGetter__("parentElement", function () {
        if (this.parentNode == this.ownerDocument) return null;
        return this.parentNode;
    });
    HTMLElement.prototype.__defineGetter__("children", function () {
        var tmp = [];
        var j = 0;
        var n;
        for (var i = 0; i < this.childNodes.length; i++) {
            n = this.childNodes[i];
            if (n.nodeType == 1) {
                tmp[j++] = n;
                if (n.name) {
                    if (!tmp[n.name])
                        tmp[n.name] = [];
                    tmp[n.name][tmp[n.name].length] = n;
                }
                if (n.id)
                    tmp[n.id] = n;
            }
        }
        return tmp;
    });
    HTMLElement.prototype.__defineGetter__("currentStyle", function () {
        return this.ownerDocument.defaultView.getComputedStyle(this, null);
    });
    HTMLElement.prototype.__defineSetter__("outerHTML", function (sHTML) {
        var r = this.ownerDocument.createRange();
        r.setStartBefore(this);
        var df = r.createContextualFragment(sHTML);
        this.parentNode.replaceChild(df, this);
        return sHTML;
    });
    HTMLElement.prototype.__defineGetter__("outerHTML", function () {
        var attr;
        var attrs = this.attributes;
        var str = "<" + this.tagName;
        for (var i = 0; i < attrs.length; i++) {
            attr = attrs[i];
            if (attr.specified)
                str += " " + attr.name + '="' + attr.value + '"';
        }
        if (!this.canHaveChildren)
            return str + ">";
        return str + ">" + this.innerHTML + "</" + this.tagName + ">";
    });
    HTMLElement.prototype.__defineGetter__("canHaveChildren", function () {
        switch (this.tagName.toLowerCase()) {
            case "area":
            case "base":
            case "basefont":
            case "col":
            case "frame":
            case "hr":
            case "img":
            case "br":
            case "input":
            case "isindex":
            case "link":
            case "meta":
            case "param":
                return false;
        }
        return true;
    });

    HTMLElement.prototype.__defineSetter__("innerText", function (sText) {
        this.textContent = sText;
    });
    HTMLElement.prototype.__defineGetter__("innerText", function () {
        return this.textContent;
    });
    HTMLElement.prototype.__defineSetter__("outerText", function (sText) {
        var parsedText = document.createTextNode(sText);
        this.outerHTML = parsedText;
        return parsedText;
    });
    HTMLElement.prototype.__defineGetter__("outerText", function () {
        var r = this.ownerDocument.createRange();
        r.selectNodeContents(this);
        return r.toString();
    });
    HTMLElement.prototype.attachEvent = function (sType, fHandler) {
        var shortTypeName = sType.replace(/on/, "");
        fHandler._ieEmuEventHandler = function (e) {
            window.event = e;
            return fHandler();
        }
        this.addEventListener(shortTypeName, fHandler._ieEmuEventHandler, false);
    }
    HTMLElement.prototype.detachEvent = function (sType, fHandler) {
        var shortTypeName = sType.replace(/on/, "");
        if (typeof (fHandler._ieEmuEventHandler) == "function")
            this.removeEventListener(shortTypeName, fHandler._ieEmuEventHandler, false);
        else
            this.removeEventListener(shortTypeName, fHandler, true);
    }
    HTMLElement.prototype.contains = function (Node) {
        do {
            if (Node == this) return true;
            Node = Node.parentNode;
        }
        while (Node);
        return false;
    }
    HTMLElement.prototype.insertAdjacentElement = function (where, parsedNode) {
        switch (where) {
            case "beforeBegin":
                this.parentNode.insertBefore(parsedNode, this);
                break;
            case "afterBegin":
                this.insertBefore(parsedNode, this.firstChild);
                break;
            case "beforeEnd":
                this.appendChild(parsedNode);
                break;
            case "afterEnd":
                if (this.nextSibling)
                    this.parentNode.insertBefore(parsedNode, this.nextSibling);
                else
                    this.parentNode.appendChild(parsedNode);
                break;
        }
    }
    HTMLElement.prototype.insertAdjacentHTML = function (where, htmlStr) {
        var r = this.ownerDocument.createRange();
        r.setStartBefore(this);
        var parsedHTML = r.createContextualFragment(htmlStr);
        this.insertAdjacentElement(where, parsedHTML);
    }
    HTMLElement.prototype.insertAdjacentText = function (where, txtStr) {
        var parsedText = document.createTextNode(txtStr);
        this.insertAdjacentElement(where, parsedText);
    }
    HTMLElement.prototype.attachEvent = function (sType, fHandler) {
        var shortTypeName = sType.replace(/on/, "");
        fHandler._ieEmuEventHandler = function (e) {
            window.event = e;
            return fHandler();
        }
        this.addEventListener(shortTypeName, fHandler._ieEmuEventHandler, false);
    }
    HTMLElement.prototype.detachEvent = function (sType, fHandler) {
        var shortTypeName = sType.replace(/on/, "");
        if (typeof (fHandler._ieEmuEventHandler) == "function")
            this.removeEventListener(shortTypeName, fHandler._ieEmuEventHandler, false);
        else
            this.removeEventListener(shortTypeName, fHandler, true);
    }
}
if (window.HTMLTableElement && HTMLTableElement.prototype.__defineGetter__) {
    HTMLTableElement.prototype.__defineGetter__("cells", function () {
        var reCells = [];
        var rows = this.rows;
        for (var i = 0, count = rows.length; i < count; i++) {
            var cells = rows[i].cells;
            for (var j = 0, len = cells.length; j < len; j++) {
                reCells.push(cells[j]);
            }
        }
        return reCells;
    });
}

/// <reference path="Control.js" />

vsClass = vs10.Layer = function () {
    var $ = $vs10, vs = vs10;
    var q = $vs10.inherit(this, arguments, vs10.Control);
    if ($.designMode) q = vs.Control.Q;
    //#region NameSpace
    var dom = $.dom, doc = $.doc, designMode = $.designMode;
    var response = $.response, server = $.server; parser = $.parser; browser = $.browser;
    var Static = q.Static;
    var Me = this;
    var nodes = q.Nodes, acts = q.Acts, handlers = q.Handlers; enums = q.Enums;
    var config = q.Config, info = q.Info, indexer = q.Indexer, data = q.Data, demos = q.Demos;
    var info = q.Info; var conifg = q.Config; var handlers = q.Handlers;
    //#endregion
    //base
    var base = $.Copy(q);
    if (Static.Private_vs_Layer == null) {
        if (window.vs11 && vs11.UI.Layer) {
            Static.Private_vs_Layer = vs11.UI.Layer.Private_vs_UI_Layer;
        } else
            Static.Private_vs_Layer = new function () {
                var S = this;
                var LAYER_BASE = 600;
                var LAYER_KEEP_TOP_BASE = 60000;
                var LAYER_STEP = 5;
                var KeepTopLayerIndexNow = LAYER_KEEP_TOP_BASE;
                var LayerZIndexNow = LAYER_BASE;
                var LayerArray = [];
                $vs10.addEvent(S, "Actived");    //active one layer

                S.NewLayer = function (layer) {
                    ///<returns type="Number"></returns>
                    var layerZIndex = LayerZIndexNow;
                    LayerZIndexNow += LAYER_STEP;
                    LayerArray.push(layer);
                    return layerZIndex;
                }
                S.NewTopLayer = function (layer) {
                    var layerZIndex = KeepTopLayerIndexNow;
                    KeepTopLayerIndexNow += LAYER_STEP;
                    return layerZIndex;
                }
                //				S.InitAllLayerPos = function () {
                //					return;
                //					for (var i = 0, count = LayerArray.length; i < count; i++) {
                //						var layer = LayerArray[i];
                //						//layer.Nodes.TopNode.style.position = "absolute";
                //						var topNode = layer.Nodes.TopNode;
                //						var topNodeStyle = layer.Nodes.TopNode.style;
                //						if (topNode.FromHear) { //topNodeStyle.marginLeft = acts.GetHearLeft(topNode) + "px";topNodeStyle.marginTop = acts.GetHearTop(topNode) + "px";
                //						}
                //						else { //topNodeStyle.left = acts.GetPosLeft(topNode) + "px";topNodeStyle.top = acts.GetPosTop(topNode) + "px";
                //						}
                //					}
                //				}
                S.SetActived = function (layerMe) {
                    var myZIndex = layerMe.GetZIndex();
                    for (var i = 0, count = LayerArray.length; i < count; i++) {
                        var layer = LayerArray[i];
                        var layerZIndex = layer.GetZIndex();
                        if (layerZIndex == myZIndex) {
                            layer.SetZIndex(LayerZIndexNow - LAYER_STEP);
                        } else if (layerZIndex > myZIndex) {
                            layer.SetZIndex(layerZIndex - LAYER_STEP);
                        }
                    }
                    S.Actived(layerMe);
                }
                S.DeleteLayer = function (layerMe) {
                    var myZIndex = layerMe.GetZIndex();
                    for (var i = 0, count = LayerArray.length; i < count; i++) {
                        var layer = LayerArray[i];
                        var layerZIndex = layer.GetZIndex();
                        if (layerZIndex == myZIndex) {
                            LayerArray.splice(i, 1);
                            break;
                        }
                    }
                }
            }
    }
    $vs10.addEvent(Me, "ToStartMove"); if (designMode) Me.ToStartMove = function (thisLayer) { }
    info.Draging = false;
    info.IsModal = false;
    info.ZIndex = -1;

    nodes.TopNode = dom.Node;
    nodes.ModalLayer = dom.Node;
    nodes.ModalFrame = dom.Iframe;
    nodes.CoverFrame = dom.Iframe;
    nodes.ViewStateHidden = dom.Input;

    info.LastPos = { Left: 0, Top: 0, OffsetWidth: 0, OffsetHeight: 0, Width: 0, Height: 0 };
    info.LastMoveHandlerNode = dom.Node;

    info.DragPos = {
        x: -1,
        y: -1
    };
    info.BackPos = {
        x: -1,
        y: -1
    }

    Me.GetZIndex = acts.GetZIndex = function () {
        return info.ZIndex;
    }
    Me.GetIsShow = acts.GetIsShow = function () {
        return (nodes.TopNode.style.display == "block");
    }
    Me.SetZIndex = acts.SetZIndex = function (zIndex) {
        info.ZIndex = zIndex;
        nodes.TopNode.style.zIndex = zIndex + 2;
        nodes.ModalLayer.style.zIndex = zIndex;
    }
    acts.SetLayer = function () {
        with (nodes.TopNode.style) {
            zIndex = info.ZIndex + 2;
        }
        with (nodes.CoverFrame) {
            frameBorder = 0;
            //			src = "about:blank";
            with (style) {
                width = nodes.TopNode.offsetWidth + "px";
                filter = "alpha(opacity=1)";
                opacity = 0.01;
                height = nodes.TopNode.offsetHeight + "px";
            }
        }
    }
    Me.ReSetLayer = acts.ReSetLayer = function () {
        with (nodes.CoverFrame) {
            with (style) {
                width = nodes.TopNode.offsetWidth + "px";
                height = nodes.TopNode.offsetHeight + "px";
            }
        }
    }
    acts.SetModal = function () {
        with (nodes.ModalLayer.style) {
            zIndex = info.ZIndex;
            filter = "alpha(opacity=60)";
            opacity = 0.6;
            display = "none";
        }
        //nodes.ModalLayer.style["-moz-opacity"] = 0.2;
        with (nodes.ModalFrame) {
            frameBorder = 0;
            //			src = "about:blank";
        }
    }
    acts.KeepModalView = function () {
        if (nodes.TopNode.offsetHeight == 0) {
            nodes.ModalLayer.style.display = "none";
            window.clearInterval(info.KeepModalViewTimer);
        }
    }
    enums.EnumWindowState = { Hidden: 0, Mined: 4, Opened: 8, Maxed: 16 }
    info.ViewState = { WindowState: 0, Left: 0, Top: 0, IsNoPos: false }
    acts.SaveViewState = function () {
        var v = info.ViewState;
        var topNode = nodes.TopNode, topNodeStyle = topNode.style;
        if (topNode.FromHear) {
            v.Left = acts.GetHearLeft(topNode); v.Top = acts.GetHearTop(topNode);
        } else {
            v.Left = acts.GetPosLeft(topNode); v.Top = acts.GetPosTop(topNode);
        }
        nodes.ViewStateHidden.value = String.format("{0}|{1}|{2}", v.WindowState, v.Left, v.Top);
    }
    var baseInit = acts.Init;
    Me.Init = acts.Init = function (isModal, topNode, fromHear) {
        if (arguments.callee.Runed === true) return; arguments.callee.Runed = true;
        if (info.ZIndex == -1) info.ZIndex = vs10.Layer.Private_vs_Layer.NewLayer(Me);
        baseInit();
        info.IsModal = (isModal === true) ? true : false;
        nodes.TopNode = topNode || dom.NewSpan("", true);
        var firstForm = document.getElementsByTagName("form")[0];
        var appendNode = (firstForm == null) ? document.body : firstForm;
        var v = info.ViewState;
        if (info.IsModal) {
            nodes.ModalFrame = dom.NewIframe();
            nodes.ModalLayer = dom.NewDiv();
            firstForm.appendChild(nodes.ModalLayer);
            nodes.ModalLayer.appendChild(nodes.ModalFrame);
        }
        nodes.CoverFrame = dom.NewIframe();
        if (!topNode) firstForm.appendChild(nodes.TopNode);
        topNodeStyle = nodes.TopNode.style;
        if (fromHear) {
            nodes.TopNode.FromHear = true;
            topNodeStyle.position = "absolute";
            v.Left = topNodeStyle.marginLeft = topNode ? acts.GetHearLeft(topNode) : 0;
            v.Top = topNodeStyle.marginTop = topNode ? acts.GetHearTop(topNode) : 0;
        } else {
            nodes.TopNode.FromHear = false;
            //无须记住相对位置,此时就选择性尝试直接将面板移动form外
            //防止因为处在隐藏节点内,而无法实现绝对定位的计算
            var forms = document.getElementsByTagName("form");
            if (topNode.offsetWidth == 0 && forms.length > 0) forms[0].appendChild(nodes.TopNode);
            if (topNode.style.display != "none") {
                v.Left = topNodeStyle.left = topNode ? acts.GetPosLeft(topNode) : 0;
                v.Top = topNodeStyle.top = topNode ? acts.GetPosTop(topNode) : 0;
            }
        }
        nodes.TopNode.appendChild(nodes.CoverFrame);
        acts.SetLayer();
        window.setTimeout(acts.ReSetLayer, 100);

        acts.SetModal();
        acts.InheritSkin("vs10_Layer");
        AttachEvent();
    }
    //	Me.StartFloatAtHear = acts.StartFloatAtHear = function(){
    //	}
    acts.ReturnFalse = function () { return false; }
    handlers.StartMove = function (event) {
        if (!Me.ToStartMove(Me)) return;
        var me = info.LastMoveHandlerNode = this; if (designMode) me = dom.Node;
        me.style.cursor = "move";
        nodes.TopNode.style.position = "absolute";
        //vs10.Layer.Private_vs_Layer.InitAllLayerPos();
        info.Draging = true;
        $vs10.addHandler(document, "mousemove", handlers.Moving);
        $vs10.addHandler(document, "mouseup", handlers.StopMove);
        $vs10.addHandler(document, "selectstart", acts.ReturnFalse);
        var mouseX = acts.GetPointerX(event);
        var mouseY = acts.GetPointerY(event);
        var leftMe = topMe = 0;
        var topNode = nodes.TopNode;
        if (topNode.FromHear) { leftMe = acts.GetHearLeft(topNode); topMe = acts.GetHearTop(topNode); }
        else { leftMe = acts.GetPosLeft(topNode); topMe = acts.GetPosTop(topNode); }
        with (info.DragPos) {
            x = mouseX;
            y = mouseY;
        }
        with (info.BackPos) {
            x = leftMe;
            y = topMe;
        }
        //document.body.style.cursor="move";
    }
    handlers.Moving = function (event) {
        if (!info.Draging) return;
        if (info.IsModal) {
            nodes.ModalLayer.style.display = "none";
        }
        var posX = acts.GetPointerX(event);
        var posY = acts.GetPointerY(event);
        var leftMe = topMe = 0;
        var topNode = nodes.TopNode;
        if (topNode.FromHear) {
            leftMe = acts.GetHearLeft(topNode); topMe = acts.GetHearTop(topNode);
        } else {
            leftMe = acts.GetPosLeft(topNode); topMe = acts.GetPosTop(topNode);
        }
        var posNowX = posX - info.DragPos.x + leftMe;
        var posNowY = posY - info.DragPos.y + topMe;

        var topNodeStyle = topNode.style;
        if (topNode.FromHear) { topNodeStyle.marginLeft = posNowX + "px"; topNodeStyle.marginTop = posNowY + "px"; }
        else { topNodeStyle.left = posNowX + "px"; topNodeStyle.top = posNowY + "px"; }
        info.DragPos.x = posX;
        info.DragPos.y = posY;
    }
    info.KeepModalViewTimer = null;
    handlers.StopMove = function (event) {
        if (!info.Draging) return;
        if (info.IsModal) {
            nodes.ModalLayer.style.display = "block";
            window.clearInterval(info.KeepModalViewTimer);
            info.KeepModalViewTimer = window.setInterval(acts.KeepModalView, 200);
        }
        var topNode = nodes.TopNode, topNodeStyle = topNode.style;
        var me = info.LastMoveHandlerNode;
        me.style.cursor = "default";
        info.Draging = false;
        $vs10.removeHandler(document, "mousemove", handlers.Moving);
        $vs10.removeHandler(document, "mouseup", handlers.StopMove);
        $vs10.removeHandler(document, "selectstart", acts.ReturnFalse);
        var mouseX = acts.GetPointerX(event) - (document.documentElement.scrollLeft || document.body.scrollLeft);
        var mouseY = acts.GetPointerY(event) - (document.documentElement.scrollTop || document.body.scrollTop);
        if (mouseX < 1 || mouseY < 1 || mouseX > document.body.clientWidth || mouseY > document.body.clientHeight) {
            if (topNode.FromHear) { topNodeStyle.marginLeft = info.BackPos.x + "px"; topNodeStyle.marginTop = info.BackPos.y + "px"; }
            else { topNodeStyle.left = info.BackPos.x + "px"; topNodeStyle.top = info.BackPos.y + "px"; }
        };
        with (info.LastPos) {
            if (topNode.FromHear) { Left = acts.GetHearLeft(topNode); Top = acts.GetHearTop(topNode); }
            else { Left = acts.GetPosLeft(topNode); Top = acts.GetPosTop(topNode); }
            OffsetWidth = parseInt(topNode.offsetWidth);
            OffsetHeight = parseInt(topNode.offsetHeight);
        }
        acts.SaveViewState();
        //document.body.style.cursor="";
    }
    Me.BindMoveHandler = acts.BindMoveHandler = function (node) {
        $vs10.addHandler(node, "mousedown", handlers.StartMove);
        node.style.cursor = "default";
    }
    var viewTopGoTimer = null;
    acts.ViewTopGo = function () {
        window.clearTimeout(viewTopGoTimer);
        viewTopGoTimer = window.setTimeout(viewTopGoTimer, 100);
    }
    acts.ViewTop = function () {
        acts.ReSetLayer();
        vs10.Layer.Private_vs_Layer.SetActived(Me);
    }
    Me.ShowAt = acts.ShowAt = function (left, top) {
        var topNode = nodes.TopNode, topNodeStyle = topNode.style;
        if (topNode.FromHear) { topNodeStyle.marginLeft = left + "px"; topNodeStyle.marginTop = top + "px"; }
        else { topNodeStyle.left = left + "px"; topNodeStyle.top = top + "px"; }
        info.ViewState.WindowState = enums.EnumWindowState.Opened;
        acts.SaveViewState();
        with (info.ShowFilterRecord) { cOpacity = 10, toOpacity = 100; }
        acts.ShowFilter();
        acts.ViewTop();
    }
    Me.Hidden = Me.Close = acts.Hidden = acts.Close = function () {
        window.clearTimeout(viewTopGoTimer);
        window.setTimeout(acts.HiddenHandler, 10);
    }
    acts.HiddenHandler = function () {
        if (nodes.TopNode.style.display != "none") { nodes.TopNode.style.OldDisplay = nodes.TopNode.style.display; }
        nodes.TopNode.style.display = "none";
        nodes.ModalLayer.style.display = "none";
        info.ViewState.WindowState = enums.EnumWindowState.Hidden;
        acts.SaveViewState();
    }
    info.ShowFilterRecord = { cOpacity: 0, toOpacity: 0 }
    info.ShowFilterTimer = null;
    acts.ShowFilter = function () {
        window.clearTimeout(info.ShowFilterTimer);
        acts.SetOpacity(nodes.TopNode, info.ShowFilterRecord.cOpacity);
        if (info.ShowFilterRecord.cOpacity < info.ShowFilterRecord.toOpacity) {
            with (info.ShowFilterRecord) { cOpacity = (cOpacity + 50) > toOpacity ? toOpacity : (cOpacity + 50); }
            info.ShowFilterTimer = window.setTimeout(acts.ShowFilter, 30);
        }
    }
    Me.Show = acts.Show = function () {
        with (info.ShowFilterRecord) { cOpacity = 10, toOpacity = 100; }
        var oldDisplay = nodes.TopNode.style.OldDisplay;
        var v = info.ViewState;
        if (!nodes.TopNode.FromHear && v.IsNoPos) {
            v.Left = nodes.TopNode.style.marginLeft = acts.GetHearLeft(nodes.TopNode);
            v.Top = nodes.TopNode.style.marginTop = acts.GetHearTop(nodes.TopNode);
        }
        acts.SetOpacity(nodes.TopNode, info.ShowFilterRecord.cOpacity);
        info.ViewState.WindowState = enums.EnumWindowState.Opened;
        acts.SaveViewState();
        acts.ShowFilter();
        nodes.TopNode.style.display = oldDisplay ? oldDisplay : "block";
        if (info.IsModal) {
            nodes.ModalLayer.style.display = "block";
            window.clearInterval(info.KeepModalViewTimer);
            info.KeepModalViewTimer = window.setInterval(acts.KeepModalView, 200);
        }
        acts.ViewTop();
    }
    Me.BindCloseButton = acts.BindCloseButton = function (closeButton) {
        if (closeButton) $.addHandler(closeButton, dom.Events.onclick, acts.Close)
    }
    acts.ReadViewState = function () {
        var arr = nodes.ViewStateHidden.value.split("|");
        var v = info.ViewState;
        v.WindowState = isNaN(parseInt(arr[0])) ? enums.EnumWindowState.Hidden : parseInt(arr[0]);
        if (arr.length >= 3) {
            v.IsNoPos = false;
            v.Left = isNaN(parseInt(arr[1])) ? 0 : parseInt(arr[1]);
            v.Top = isNaN(parseInt(arr[2])) ? 0 : parseInt(arr[2]);
            var topNode = nodes.TopNode, topNodeStyle = topNode.style;
            if (topNode.FromHear) { topNodeStyle.marginLeft = v.Left + "px"; topNodeStyle.marginTop = v.Top + "px"; }
            else { topNodeStyle.left = v.Left + "px"; topNodeStyle.top = v.Top + "px"; }
        } else { v.IsNoPos = true; }
    }
    Me.BindViewState = acts.BindViewState = function (viewStateHiddenNode) {
        nodes.ViewStateHidden = viewStateHiddenNode;
        acts.ReadViewState();
        acts.SaveViewState();
        return info.ViewState.WindowState;
    }
    Me.LoadViewState = acts.LoadViewState = function () {
        acts.ReadViewState();
        nodes.TopNode.style.visibility = "visible";
        var v = info.ViewState;
        switch (v.WindowState) {
            case enums.EnumWindowState.Opened:
                acts.Show();
                break;
            case enums.EnumWindowState.Hidden:
                acts.Close();
                break;
            case enums.EnumWindowState.Mined:
                //todo
                acts.Show();
                break;
            case enums.EnumWindowState.Maxed:
                //todo
                acts.Show();
                break;
        }
        var topNode = nodes.TopNode, topNodeStyle = topNode.style;
        if (topNode.FromHear) { topNodeStyle.marginLeft = v.Left + "px"; topNodeStyle.marginTop = v.Top + "px"; }
        else { topNodeStyle.left = v.Left + "px"; topNodeStyle.top = v.Top + "px"; }
    }
    var baseDestroy = q.Destroy;
    q.Destroy = function () {
        vs10.Layer.Private_vs_Layer.DeleteLayer(Me);
        if (info.IsModal) {
            nodes.ModalLayer.removeNode(true);
        }
        baseDestroy();
    }
    var AttachEvent = function () {
        $vs10.addHandler(nodes.TopNode, "mousedown", acts.ViewTop);
    }
}
$vs10.initType(vsClass);

vsClass.$new = function(isModal,topNode,isHear){
    ///<returns type="vs10.Layer.Type"></returns>
    return this.New.apply(this,arguments);
}

/// <reference path="vs.Framework.js" />
$vs10.parser = {};
$vs10.parser.parserOne = function(obj){
	var text = "",tag = "",hasProperty = false;
	for(prop in obj){
		if(typeof(obj[prop]) == "function")continue;
		var value = (""+obj[prop]).replace("'","\\'");
		text += tag + prop + "=" + 
		    ((obj[prop]==null)?"null":
		        ((obj[prop].constructor == Array) 
		        ? "['"+value + "']" 
		        : "'"+value+"'")
		    );
		tag = "\/";
		hasProperty = true;
	}
	if(hasProperty){
	    text = text.replace(new RegExp(",","g"),"','");text = text.replace(new RegExp("\/","g"),",");
	}else{text = obj;}
    text = text.replace(new RegExp("<","g"),"&lt;");text = text.replace(new RegExp(">","g"),"&gt;");
	text = "{" + text + "}";
	return text;
}
$vs10.parser.view = function(obj,Document){
	var div = (Document || document).createElement("DIV");
	div.innerHTML = this.parserOne(obj);
	(Document || document).body.appendChild(div);
}

/// <reference path="vs_common.js" />
/// <reference path="Control.js" />
/// <reference path="dom.js" />
vsClass = vs10.TreeNode = function () {
	var q = $vs10.inherit(this, arguments, vs10.Control);
	if ($vs10.designMode) q = vs10.Control.Q;

	var Me = this;
	var dom = $vs10.dom;
	var acts = q.Acts;
	$vs10.addEvent(Me, "Expanded"); //已经取消折叠状态
	$vs10.addEvent(Me, "Folded"); //已经进入折叠状态
	$vs10.addEvent(Me, "NeedLoadChilds"); //需要加载子节点
	$vs10.addEvent(Me, "Focused"); //选中了
	$vs10.addEvent(Me, "Blured"); //取消选中

	q.Events.Expanded = function () { Me.Expanded(); }
	q.Events.Folded = function () { Me.Folded(); }
	q.Events.NeedLoadChilds = function () { Me.NeedLoadChilds(); };
	q.Events.Focused = function () { Me.Focused(); };
	q.Events.Blured = function () { Me.Blured(); };

	q.Nodes.TopNode = dom.LI;
	q.Nodes.LineTable = dom.Table;
	q.Nodes.FoldedImage = dom.Image;
	q.Nodes.EndImage = dom.Image;
	q.Nodes.ExpandedImage = dom.Image;
	q.Nodes.Ico = dom.Label;
	q.Nodes.Link = dom.A;
	q.Nodes.LoadingImage = dom.Image;

	q.Config.ImageFolder = $vs10.server.mapPath("~/skin/default/vs_Tree/");
	q.Config.ExpandedImage = q.Config.ImageFolder + "o.gif";
	q.Config.FoldedImage = q.Config.ImageFolder + "c.gif";
	q.Config.EndImage = q.Config.ImageFolder + "e.gif";
	q.Config.LoadingImage = q.Config.ImageFolder + "s.gif";

	q.Info.ParentNode = null;
	q.Info.ChildNodes = [];
	q.Info.AutoExpand = false;
	q.Info.ViewIco = true;
	q.Info.Expanded = false;
	q.Info.NeedLoadChild = false;
	var dom = $vs10.dom;

	var baseInit = q.Init;
	Me.Init = q.Init = function (needLoadChild, autoExpand, viewIco) {
		baseInit();
		if (needLoadChild == true) q.Info.NeedLoadChild = true;
		if (autoExpand == true) q.Info.AutoExpand = true;
		if (viewIco == false) q.Info.ViewIco = false;

		q.Nodes.TopNode = dom.NewLI();
		var linkCell;
		var table;
		with (q.Nodes) {
			table = q.Nodes.LineTable = $vs10.dom.NewTable(); table.border = 0; table.cellPadding = 0; table.cellSpacing = 0; table.style.width = "100%";
			var row = table.insertRow(-1);
			FoldedImage = row.insertCell(-1);
			FoldedImage.style.display = "none";
			EndImage = row.insertCell(-1);
			EndImage.style.display = "none";
			ExpandedImage = row.insertCell(-1);
			ExpandedImage.style.display = "none";
			Ico = row.insertCell(-1);
			Ico.style.display = q.Info.ViewIco ? "inline" : "none";
			linkCell = row.insertCell(-1);
			LoadingImage = row.insertCell(-1);
			LoadingImage.style.display = "none";
			if (q.Info.AutoExpand) window.setTimeout(acts.Expand, 100);
		}
		q.Nodes.Link = dom.NewALink(null, null, dom.Blank);
		with (q.Nodes) {
			TopNode.appendChild(table);
			linkCell.appendChild(Link);
		}
		acts.InheritSkin("vs10_TreeNode");
		AttachEvent();
	}
	Me.SetParentNode = q.SetParentNode = function (parentNode) {
		q.Info.ParentNode = parentNode;
	}
	Me.GetParentNode = q.GetParentNode = function () {
		/// <returns type="vs10.TreeNode.Type"></returns>
		return q.Info.ParentNode;
	}
	Me.HasChild = q.HasChild = function () {
		/// <returns type="Boolean"></returns>
		return (q.Info.ChildNodes.length != 0);
	}
	Me.AddChild = q.AddChild = function (childNode) {
		q.Info.ChildNodes.push(childNode);
		childNode.SetParentNode(Me);
	}
	Me.RemoveChild = q.RemoveChild = function (childNode) {
		var childs = q.Info.ChildNodes;
		for (var i = 0; i < childs; i++) {
			if (childs[i] == childNode) {
				childs.splice(i, 1);
				return;
			}
		}
	}
	Me.Expand = acts.Expand = function () {
		if (q.HasChild()) {
			var treeView = q.Nodes.LineTable.nextSibling;
			if (treeView) treeView.style.display = "block";
			q.Nodes.ExpandedImage.style.display = "inline";
			q.Nodes.FoldedImage.style.display = "none";
			with (q.Nodes.Ico.style) {
				backgroundPositionX = "-20px";
			}
			q.Info.Expanded = true;
			q.Events.Expanded();
		} else if (q.Info.NeedLoadChild) {
			q.Nodes.LoadingImage.style.display = "inline";
			with (q.Nodes.Ico.style) {
				backgroundPositionX = "-20px";
			}
			q.Events.NeedLoadChilds();
			q.Info.NeedLoadChild = false;
			acts.Expand();
			q.Nodes.LoadingImage.style.display = "none";
		}
	}
	Me.Fold = acts.Fold = function () {
		var treeView = q.Nodes.LineTable.nextSibling;
		if (treeView) treeView.style.display = "none";
		q.Nodes.ExpandedImage.style.display = "none";
		q.Nodes.FoldedImage.style.display = "inline";
		with (q.Nodes.Ico.style) {
			backgroundPositionX = "0px";
		}
		q.Info.Expanded = false;
		q.Events.Folded();
	}
	Me.ChgFoldState = acts.ChgFoldState = function () {
		if (q.Info.Expanded) { acts.Fold(); }
		else { acts.Expand(); }
	}
	Me.GetAllChilds = q.GetAllChilds = function () {
		/// <returns type="Array"></returns>
		return q.Info.ChildNodes.concat([]);
	}
	Me.SetLink = q.SetLink = function (html, href, target) {
		q.Nodes.Link.innerHTML = Object.isNullOrEmpty(html, dom.Blank);
		q.Nodes.Link.href = Object.isNullOrEmpty(href, dom.DoNothingHref);
		q.Nodes.Link.target = Object.isNull(target, dom.A.EnumTarget.Self);
	}
	Me.View = q.View = function () {
		if (q.HasChild()) {
			acts.Expand();
			var childs = q.Info.ChildNodes;
			for (var i = 0, count = childs.length; i < count; i++) {
				if (childs[i].View) childs[i].View();
			}
		} else if (q.Info.NeedLoadChild) {
			acts.Fold();
			var childs = q.Info.ChildNodes;
			for (var i = 0, count = childs.length; i < count; i++) {
				if (childs[i].View) childs[i].View();
			}
		} else {
			q.Nodes.Ico.style.backgroundPositionX = "-40px";
			q.Nodes.EndImage.style.display = "inline";

		}
		delete (Me.View);
	}
	Me.CreateTree = acts.CreateTree = function () {
		/// <returns type="vs10.Tree.Type"></returns>
		var tree = vs10.Tree.$new(Me);
		q.Nodes.TopNode.appendChild(tree.Nodes.TopNode);
		return tree;
	}
	q.Handlers.LinkFocus = function (e) {
		var linkArea = this;
		if (!String) linkArea = $vs10.dom.A;
		linkArea.style.backgroundColor = "#326ABD";
		linkArea.style.color = "white";
		q.Events.Focused();
		return false;
	}
	q.Handlers.LinkBlur = function (e) {
		var linkArea = this;
		if (!String) linkArea = $vs10.dom.A;
		linkArea.style.backgroundColor = "";
		linkArea.style.color = "black";
		q.Events.Blured();
		return false;
	}

	var AttachEvent = function () {
		$vs10.addHandler(q.Nodes.FoldedImage, $vs10.dom.Events.onclick, function (e) {
			acts.Expand();
		});
		$vs10.addHandler(q.Nodes.Ico, $vs10.dom.Events.ondblclick, function (e) {
			acts.ChgFoldState();
		});
		$vs10.addHandler(q.Nodes.Link, $vs10.dom.Events.onfocus, q.Handlers.LinkFocus);
		$vs10.addHandler(q.Nodes.Link, $vs10.dom.Events.onblur, q.Handlers.LinkBlur);
		$vs10.addHandler(q.Nodes.ExpandedImage, $vs10.dom.Events.onclick, function (event) {
			acts.Fold();
		});
	}
}
$vs10.initType(vsClass);
vsClass.$new = function(needLoadChild,autoExpand,viewIco){
	/// <param name="needLoadChild">是否需要加载子节点,默认值为true</param>
	/// <param name="autoExpand">初始加载后是否展开,此设置只在needLoadChild为false时有效,默认值为false</param>
	/// <param name="viewIco">是否显示前置ico图标</param>
	/// <returns type="vs10.TreeNode.Type"></returns>
	return this.New.apply(this,arguments);
}

vsClass = vs10.Tree = function(){
	var q = $vs10.inherit(this,arguments,vs10.Control);
	if($vs10.designMode)q = vs10.Control.Q;
	
	var Me = this;
	var acts = q.Acts;
	var dom = $vs10.dom;
	try{
	q.Bind.TreeNode = vs10.TreeNode.Demo;
	}catch(e){}
	q.Nodes.TopNode = dom.UL;
	var ChildNodes = [];
	
	var baseInit = q.Init;
	Me.Init = q.Init = function(treeNode){
		baseInit();
		q.Nodes.TopNode = dom.NewUL();
		q.Bind.TreeNode = treeNode;
		acts.InheritSkin("vs10_Tree");
	}
	Me.IsTop = acts.IsTop = function(){
		return (q.Bind.TreeNode == null);
	}
	Me.AddNode = acts.AddNode = function(treeNode){
		if(!String)treeNode = vs10.TreeNode.Demo;
		var parentNode = q.Bind.TreeNode;
		if(!String)parentNode = vs10.TreeNode.Demo;
		q.Nodes.TopNode.appendChild(treeNode.Nodes.TopNode);
		if(parentNode) parentNode.AddChild(treeNode);
		ChildNodes.push(treeNode);
	}
	Me.View = function(){
		//if(!acts.IsTop())return;
		var treeNode;
		for(var i=0,count = ChildNodes.length;i<count;i++){
			treeNode = ChildNodes[i];
			if(!String)treeNode = vs10.TreeNode.Demo;
			treeNode.View();
		}
	}
}
$vs10.initType(vsClass);
vsClass.$new = function(treeNode){
	/// <returns type="vs10.Tree.Type"></returns>
	return this.New.apply(this,arguments);
}

vsClass = vs10.MultiTree = function(){
	var q = $vs10.inherit(this,arguments,vs10.Control);
	if($vs10.designMode)q = vs10.Control.Q;
	
	var Me = this;
	var acts = q.Acts;var dom = $vs10.dom;
	
	q.Nodes.TopNode = dom.Div;
	q.Info.TopTree = vs10.Tree.Demo;
	
	var baseInit = q.Init;
	Me.Init = q.Init = function(mainCase){
		baseInit();
		q.Nodes.TopNode = mainCase;
		q.Info.TopTree = null;
		acts.InheritSkin("vs10_MultiTree");
	}
	Me.CreateTopTree = acts.CreateTopTree = function(){
		/// <summary>创建顶部树</summary>
		/// <returns type="vs10.Tree.Type"></returns>
		var topTree = vs10.Tree.$new();
		q.Info.TopTree = topTree;
		return topTree;
	}
	Me.View = acts.View = function(){
		var topTree = q.Info.TopTree;
		if(topTree){
			q.Nodes.TopNode.appendChild(topTree.Nodes.TopNode);
			topTree.View();
		}
	}
}
$vs10.initType(vsClass);
vsClass.$new = function(mainCase){
	/// <returns type="vs10.MultiTree.Type"></returns>
	return this.New.apply(this,arguments);
}

vsClass = vs10.TreeBinder = function () {
    var q = $vs10.inherit(this, arguments, vs10.Object);
    if ($vs10.designMode) q = vs10.Object.Q;
    var Me = this;
    var acts = q.Acts, dom = $vs10.dom;
    $vs10.addEvent(Me, "NodeTextClicked");
    $vs10.addEvent(Me, "NodeTextDblClicked");

    q.Events.NodeTextClicked = function () {
        ///<summary>单击了树节点</summary>
        Me.NodeTextClicked();
    }

    q.Events.NodeTextDblClicked = function () {
        ///<summary>双击了树节点</summary>
        Me.NodeTextDblClicked();
    }

    q.Nodes.TopNode = dom.Node;
    q.Info.MultiTree = vs10.MultiTree.Demo;
    q.Info.TreeData = { text: "", href: "", target: "Main", ico: null, childs: [
        { text: "", href: "" }, { text: "", href: "" }
    ]
    };
    q.Info.LastClickNode = null;
    q.Info.LastClickNodeData = null;
    q.Config.Target = "Main";

    //委托
    Me.Handlers = {};
    Me.Handlers.ReadChilds = q.Handlers.ReadChilds = function (obj) {
        ///<summary>读取节点对象的子元素数组，不存在请返回[]</summary>
        ///<returns type="Array"><returns>
        return obj.childs;
    }
    Me.Handlers.ReadText = q.Handlers.ReadText = function (obj) {
        ///<summary>读取节点对象的显示文本</summary>
        ///<returns type="String"><returns>
        return obj.text;
    }
    Me.Handlers.ReadHref = q.Handlers.ReadHref = function (obj) {
        ///<summary>读取节点对象的链接文本</summary>
        ///<returns type="String"><returns>
        return obj.href;
    }
    Me.Handlers.ReadTarget = q.Handlers.ReadTarget = function (obj) {
        ///<summary>读取节点对象的链接目标窗体名称</summary>
        ///<returns type="String"><returns>
        return Object.isNull(obj.target, "");
    }
    Me.Handlers.ReadIco = q.Handlers.ReadIco = function (obj) {
        ///<summary>读取节点对象的前置图标URL,可使用$vs10.server.mapPath来实现对"~"开头的绝对路径</summary>
        ///<returns type="String"><returns>
        return Object.isNullOrEmpty(obj.ico, null);
    }
    Me.Handlers.ReadNeedLoadChild = q.Handlers.ReadNeedLoadChild = function (obj) {
        ///<summary>读取节点对象是否还需要动态追加子节点</summary>
        ///<returns type="Boolean"><returns>
        return Object.isNull(obj.needLoadChild, false);
    }
    Me.Handlers.ReadAutoExpand = q.Handlers.ReadAutoExpand = function (obj) {
        ///<summary>读取节点对象的加载后就自动展开</summary>
        ///<returns type="Boolean"><returns>
        return Object.isNull(obj.autoExpand, true);
    }
    Me.Handlers.ReadViewIco = q.Handlers.ReadViewIco = function (obj) {
        ///<summary>是否显示ico前置类型图标</summary>
        ///<returns type="Boolean"><returns>
        return Object.isNull(obj.viewIco, true);
    }
    Me.Handlers.ReadAutoClick = q.Handlers.ReadAutoClick = function (obj) {
        ///<summary>是否自动点击</summary>
        ///<returns type="Boolean"><returns>
        return Object.isNull(obj.autoClick, true);
    }
    //事件响应
    //单击
    q.Handlers.NodeClick = function (e) {
        var node = this.TreeBinderNode;
        q.Info.LastClickNode = node;
        q.Info.LastClickNodeData = node.Bind.ViewData;
        q.Events.NodeTextClicked();
        return false;
    }
    //双击
    q.Handlers.NodeDblClick = function (e) {
        q.Events.NodeTextDblClicked();
        return false;
    }
    //需要加载子节点
    q.Handlers.OnNeedLoadChilds = function (e) {
        var node = this;
        if (!String) node = vs10.TreeNode.Q;
        var treeData = node.Bind.ViewData;
        var tree = acts.InitNextTree(null, node, treeData, true);
        tree.View();
    }
    //绑定节点单击
    q.Handlers.BindNodeClick = function (node) {
        node.Nodes.Link.TreeBinderNode = node;
        $vs10.addHandler(node.Nodes.Link, $vs10.dom.Events.onclick, q.Handlers.NodeClick);
        $vs10.addHandler(node.Nodes.Link, $vs10.dom.Events.ondblclick, q.Handlers.NodeDblClick);
    }
    //加载本节点及直属下级节点
    acts.InitNextTree = function (parentTree, treeMe, treeData, loadNextLevel) {
        if (!String) parentTree = vs10.Tree.Demo;
        if (!String) treeData = q.Info.TreeData;
        var h = Me.Handlers;
        var node = treeMe;
        if (!node) {
            //取值
            //var needLoadChild = h.ReadNeedLoadChild(treeData)
            needLoadChild = (h.ReadChilds(treeData).length > 0);
            var autoExpand = h.ReadAutoExpand(treeData);
            var autoClick = h.ReadAutoClick(treeData);
            var viewIco = h.ReadViewIco(treeData);
            var text = h.ReadText(treeData);
            var href = h.ReadHref(treeData);
            var target = h.ReadTarget(treeData);
            //进行修正
            viewIco = Object.isNullOrEmpty(viewIco, true);
            target = Object.isNull(target, q.Config.Target);
            //创建节点
            var node = vs10.TreeNode.$new(needLoadChild, autoExpand, viewIco);
            node.SetLink(text, href, target);
            parentTree.AddNode(node);
            //关联事件
            q.Handlers.BindNodeClick(node);
            //关联节点与数据对象
            node.Bind.ViewData = treeData;
            //关联加载事件
            node.OnNeedLoadChilds.push(q.Handlers.OnNeedLoadChilds);
        }
        //继续添加直属子节点
        if (loadNextLevel) {
            //取子节点数据
            var childs = h.ReadChilds(treeData);
            if (!childs || childs.length == 0) return;
            //加载
            var childTree = node.CreateTree();
            for (var i = 0, count = childs.length; i < count; i++) {
                childs[i].ParentTree = treeData;
                acts.InitNextTree(childTree, null, childs[i], false);
            }
            return childTree;
        }
    }
    acts.InitTree = function () {
        var multiTree = q.Info.MultiTree = vs10.MultiTree.$new(q.Nodes.TopNode);
        var topTree = multiTree.CreateTopTree();
        acts.InitNextTree(topTree, null, q.Info.TreeData, true);
    }
    //公开    
    var baseInit = q.Init;
    Me.Init = q.Init = function () {
        baseInit();
        if (!String) treeData = q.Info.TreeData;

    }
    Me.Show = acts.Show = function (mainCase, treeData) {
        ///<summary>呈现树</summary>
        q.Nodes.TopNode = mainCase;
        q.Info.TreeData = treeData;
        q.Config.Target = q.Handlers.ReadTarget(q.Info.TreeData);
        acts.InitTree();
        q.Info.MultiTree.View();
    }
    Me.GetLastClickNode = acts.GetLastClickNode = function () {
        ///<summary>读取最后单击的树节点</summary>
        ///<returns type="vs10.TreeNode.Type"></returns>
        return q.Info.LastClickNode;
    }
    Me.GetLastClickNodeData = acts.GetLastClickNodeData = function () {
        ///<summary>读取最后单击的树节点关联的数据对象</summary>
        ///<returns type="Object"></returns>
        return q.Info.LastClickNodeData;
    }
}
window.tree = null;
$vs10.initType(vsClass);
vsClass.$new = function(){
    ///<returns type="vs10.TreeBinder.Type"></returns>
    return this.New.apply(this,arguments);
}

/// <reference path="../vs10/dom.ext.js" />
/// <reference path="../vs10/vs.Framework.js" />
/// <reference path="../vs10/dom.js" />
/// <reference path="../vs10/Control.js" />
/// <reference path="../vs10/Tree.js" />

if (typeof (eastcom10) == "undefined") var eastcom10 = {};

function Refresh_WebForm_CallbackData() {
    __theFormPostData = "";
    __theFormPostCollection = new Array();
    if (window.WebForm_InitCallback) WebForm_InitCallback();
}

/// <reference path="base.js" />
vsClass = eastcom10.Types = function () {
    var $ = $vs10, vs = vs10;
    var q = $.q(this, arguments, vs.Control);
    if ($.designMode) q = vs.Control.Q;
    //namespace
    var dom = $.dom, doc = $.doc, designMode = $.designMode;
    var response = $.response, server = $.server; parser = $.parser; browser = $.browser;
    //me
    var Me = this;
    var nodes = q.Nodes, acts = q.Acts, handlers = q.Handlers;
    var config = q.Config, info = q.Info, indexer = q.Indexer, data = q.Data, demos = q.Demos;
    //base
    var base = $.Copy(q);
    //
    var constructor = Me.Init = q.Init = function () {

    }
}
$vs10.Q(vsClass);
vsClass.$new = function () {
    /// <returns type="eastcom10.TreeSelecter.Type"></returns>
    return this.New.apply(this, arguments);
}

/// <reference path="base.js" />
vsClass = eastcom10.TabScroller = function () {
    var $ = $vs10, vs = vs10;
    var q = $.q(this, arguments, vs.Control);
    if ($.designMode) q = vs.Control.Q;
    //namespace
    var dom = $.dom, doc = $.doc, designMode = $.designMode;
    var response = $.response, server = $.server; parser = $.parser; browser = $.browser;
    //me
    var Me = this;
    var nodes = q.Nodes, acts = q.Acts, handlers = q.Handlers;
    var config = q.Config, info = q.Info, indexer = q.Indexer, data = q.Data, demos = q.Demos;
    //base
    var base = $.Copy(q);
    //
    var s = dom.Div;
    var st = dom.Table;
    var leftList = dom.Table;
    var rightList = dom.Table;
    var leftStartIndex = 0;
    var constructor = Me.Init = q.Init = function (tabsView, leftListTable, rightListTable, moveLeft, moveRight) {
        var s = tabsView; if (designMode) s = dom.Table;
        var st = s.getElementsByTagName('table')[0];
        var leftList = leftListTable;
        var rightList = rightListTable;
        var tryHidden = function () {
            s.style.width = '10px';
            for (var i = 0; i < st.cells.length; i++) {
                st.cells[i].style.display = 'none';
            }
            s.style.width = s.parentNode.offsetWidth;
        }
        var tryOpen = function () {
            for (var i = 0; i < st.cells.length; i++) {
                if (i < leftStartIndex) {//呈现在左列表
                    st.cells[i].style.display = 'none';
                    leftList.rows[i].style.display = 'inline';
                    rightList.rows[i].style.display = 'none';
                } else {//呈现在Tab区或右列表
                    st.cells[i].style.display = 'inline';
                    leftList.rows[i].style.display = 'none';
                    rightList.rows[i].style.display = 'none';
                    if (st.offsetWidth > s.offsetWidth) {
                        //呈现在右列表
                        for (; i < st.cells.length; i++) {
                            st.cells[i].style.display = 'none';
                            leftList.rows[i].style.display = 'none';
                            rightList.rows[i].style.display = 'inline';
                        }
                        break;
                    }
                }
                //更新左右列表的位置
                RefreshListPos();
            }
        }
        var RefreshListPos = function () {
            leftList.parentNode.style.marginTop = leftList.parentNode.offsetHeight * -1;
            rightList.parentNode.style.marginLeft = rightList.parentNode.offsetWidth * -1;
        }
        var initAllLeftAndRightTabs = function () {
            for (var i = 0; i < st.cells.length; i++) {
                leftList.insertRow(-1).insertCell(-1).innerText = st.cells[i].title;
                rightList.insertRow(-1).insertCell(-1).innerText = st.cells[i].title;
            }
        }
        var RefreshTimer = null;
        var Refresh = function () {
            window.clearTimeout(RefreshTimer);
            tryHidden();
            window.setTimeout(tryOpen, 1)
        }
        handlers.moveLeft = function () {
            leftStartIndex++; Refresh();
        };
        $.addHandler(moveLeft, dom.Events.onclick, handlers.moveLeft);
        handlers.moveRight = function () {
            leftStartIndex--; Refresh();
        }
        $.addHandler(moveRight, dom.Events.onclick, handlers.moveRight);
        window.onresize = Refresh;
        Refresh();
        initAllLeftAndRightTabs();
    }
}
$vs10.Q(vsClass);
vsClass.$new = function () {
    /// <returns type="eastcom10.TreeSelecter.Type"></returns>
    return this.New.apply(this, arguments);
}

/// <reference path="base.js" />
vsClass = eastcom10.MoveSelecter = function () {
    var $ = $vs10, vs = vs10;
    var q = $.q(this, arguments, vs.Control);
    if ($.designMode) q = vs.Control.Q;
    //namespace
    var dom = $.dom, doc = $.doc, DM = designMode = $.designMode;
    var response = $.response, server = $.server; parser = $.parser; browser = $.browser;
    //me
    var Me = this;
    var nodes = q.Nodes, acts = q.Acts, handlers = q.Handlers, events = q.Events;
    var config = q.Config, info = q.Info, indexer = q.Indexer, data = q.Data, demos = q.Demos;
    //base
    var base = $.Copy(q);
    //nodes
    nodes.LikeSearchInput = dom.Input;
    nodes.LeftSelect = nodes.RightSelect = dom.Select;
    nodes.MoveFocusedToRight = nodes.MoveAllToRight = nodes.MoveFocusedToLeft = nodes.MoveAllToLeft = dom.Button;
    nodes.MoveButton = [];
    info.StopMoving = false;
    //demos
    demos.DataItem = { ID: "", ParentID: "", Name: "", Code: "" };
    //events
    $.addEvent(Me, "ItemSelected");
    $.addEvent(Me, "ItemSelectedOK");
    $.addEvent(Me, "SelectChged");
    $.addEvent(Me, "SelectClear");
    events.ItemSelected = Me.ItemSelected;
    events.ItemSelectedOK = Me.ItemSelectedOK;
    events.SelectChged = Me.SelectChged;
    events.SelectClear = Me.SelectClear;
    //acts
    acts.AddItemToLeft = function (dataItem) {
        if (DM) dataItem = demos.DataItem;
        var opt = dom.NewOption(dataItem.Name, dataItem.ID);
        opt.DataItem = dataItem;
        nodes.LeftSelect.options.add(opt);
        //        $.addHandler(opt,dom.Events.onclick,handlers.LeftSelectOption_onclick);
        //        $.addHandler(opt,dom.Events.ondblclick,handlers.LeftSelectOption_ondblclick);
        return opt;
    }
    acts.AddItemToRight = function (dataItem) {
        if (DM) dataItem = demos.DataItem;
        var opt = dom.NewOption(dataItem.Name, dataItem.ID);
        opt.DataItem = dataItem;
        nodes.RightSelect.options.add(opt);
        //        $.addHandler(opt,dom.Events.onclick,handlers.RightSelectOption_onclick);
        //        $.addHandler(opt,dom.Events.ondblclick,handlers.RightSelectOption_ondblclick);
        return opt;
    }
    acts.ReadIndexer = function (selectNode) {
        if (DM) selectNode = dom.Select;
        var indexer = {};
        $.foreach(selectNode.options, function (opt) {
            indexer[opt.DataItem.ID] = opt;
        })
        return indexer;
    }
    info.ExistAlertTimer = null;
    info.ExistAlertTimerIndex = 0;
    info.ExistAlertArr = [];
    config.AlertBgColor = ["", "#E0E1FF", "#BEC1FE", "#979CFD", "#6F76FD", "#5158FC"]
    acts.ExistAlertGo = function () {
        $.foreach(info.ExistAlertArr, function (opt) {
            opt.style.backgroundColor = config.AlertBgColor[info.ExistAlertTimerIndex];
        });
        info.ExistAlertTimerIndex--;
        if (info.ExistAlertTimerIndex < 0) return;
        info.ExistAlertTimer = window.setTimeout(acts.ExistAlertGo, 100);
    }
    acts.ExistAlert = function (optArr) {
        window.clearTimeout(info.ExistAlertTimer);
        $.foreach(info.ExistAlertArr, function (opt) {
            opt.style.backgroundColor = config.AlertBgColor[0];
        });
        if (optArr.length == 0) return;
        info.ExistAlertArr = optArr;
        info.ExistAlertTimerIndex = 5;
        info.ExistAlertTimer = window.setTimeout(acts.ExistAlertGo, 100);
    }
    //Me
    var constructor = Me.Init = q.Init = function (leftSelect, rightSelect
        , moveFocusedToRight, moveAllToRight, moveFocusedToLeft, moveAllToLeft) {
        //
        nodes.LeftSelect = leftSelect;
        nodes.RightSelect = rightSelect;
        nodes.MoveAllToLeft = moveAllToLeft;
        nodes.MoveAllToRight = moveAllToRight;
        nodes.MoveFocusedToLeft = moveFocusedToLeft;
        nodes.MoveFocusedToRight = moveFocusedToRight;
        nodes.MoveButton.push(moveFocusedToRight); nodes.MoveButton.push(moveAllToRight);
        nodes.MoveButton.push(moveFocusedToLeft); nodes.MoveButton.push(moveAllToLeft);
        acts.InheritSkin("eastcom10_MoveSelecter");

        //nodes.LeftSelect.title = "按住ctrl或拖动鼠标可多选，双击移到[已选]";
        nodes.RightSelect.title = "双击可移除";
        //
        acts.AttachEvent();
    }
    Me.Clear = acts.Clear = function () {
        nodes.LeftSelect.options.length = 0;
        nodes.RightSelect.options.length = 0;
        events.SelectClear();
    }
    Me.PushList = acts.PushList = function (itemList) {
        ///<param name="itemList">节点要求:[{ID:"",ParentID:"",Name:"",Code:""},...]</param>
        var indexer = acts.ReadIndexer(nodes.LeftSelect);
        var opts = [];
        for (var i = 0, length = itemList.length; i < length; i++) {
            if (!indexer[itemList[i].ID]) {
                opts.push(acts.AddItemToLeft(itemList[i]));
            } else { opts.push(indexer[itemList[i].ID]) }
        }
        acts.ExistAlert(opts);
    }
    Me.PushIndexList = acts.PushIndexList = function (itemIndexList) {
        ///<param name="itemIndexList">节点要求:{"ID001":{ParentID:"",Name:"",Code:""},...}</param>
        var itemList = [];
        for (var index in itemIndexList) { itemIndexList[index].ID = index; itemList.push(itemIndexList[index]); }
        acts.PushList(itemList);
    }
    Me.ClearAndPushList = acts.ClearAndPushList = function (itemList) {
        ///<param name="itemList">节点要求:[{ID:"",ParentID:"",Name:"",Code:""},...]</param>
        nodes.LeftSelect.options.length = 0;
        acts.PushList(itemList);
    }
    Me.ClearAndPushIndexList = acts.ClearAndPushIndexList = function (itemIndexList) {
        ///<param name="itemIndexList">节点要求:{"ID001":{ParentID:"",Name:"",Code:""},...}</param>
        nodes.LeftSelect.options.length = 0;
        acts.PushIndexList(itemIndexList);
        info.LastClickDataItem = null;
        //events.ItemSelected();
    }
    Me.ReadLeftResults = acts.ReadLeftResults = function () {
        ///<summary>返回:[{ID:"",ParentID:"",Name:"",Code:""},...]</summary>
        var opts = nodes.LeftSelect.options;
        var re = [];
        for (var i = 0, length = opts.length; i < length; i++) {
            var opt = opts[i];
            if (opt.DataItem) re.push(opt.DataItem);
        }
        return re;
    }
    Me.ReadRightResults = acts.ReadRightResults = function () {
        ///<summary>返回:[{ID:"",ParentID:"",Name:"",Code:""},...]</summary>
        var opts = nodes.RightSelect.options;
        var re = [];
        for (var i = 0, length = opts.length; i < length; i++) {
            var opt = opts[i];
            if (opt.DataItem) re.push(opt.DataItem);
        }
        return re;
    }
    info.LastClickDataItem = { ID: "", ParentID: "", Name: "", Code: "" };
    Me.ReadDataItemOfLastClicked = acts.ReadDataItemOfLastClicked = function () {
        ///<summary>返回:{ID:"",ParentID:"",Name:"",Code:""}</summary>
        return info.LastClickDataItem;
    }
    //handlers
    handlers.MoveAllToLeftAndClear = function () {
        if (info.StopMoving) return;
        nodes.RightSelect.options.length = 0;
        events.SelectChged();
    }
    Me.MoveAllToRight = handlers.MoveAllToRight = function () {
        //if (info.StopMoving) return;
        var isFirst = true;
        var indexer = acts.ReadIndexer(nodes.RightSelect);
        var opts = [];
        $.foreach(nodes.LeftSelect.options, function (opt) {
            if (DM) opt = dom.Option;
            if (!indexer[opt.DataItem.ID]) {
                var newOption = dom.NewOption(opt.text, opt.value);
                if (isFirst) newOption.style.fontWeight = "bold";
                opts.push(newOption);
                newOption.DataItem = opt.DataItem;
                nodes.RightSelect.options.add(newOption);
                isFirst = false;
            } else { opts.push(indexer[opt.DataItem.ID]); }
        })
        nodes.LeftSelect.options.length = 0;
        acts.ExistAlert(opts);
        events.SelectChged();
    }
    handlers.MoveFocusedToLeftAndClear = function () {
        if (info.StopMoving) return;
        $.foreach(nodes.RightSelect.options, function (opt) {
            if (DM) opt = dom.Option;
            if (!opt.selected) return;
            opt.removeNode(true);
        })
        events.SelectChged();
    }
    handlers.MoveFocusedToRight = function () {
        if (info.StopMoving) return;
        var isFirst = true;
        var indexer = acts.ReadIndexer(nodes.RightSelect);
        var opts = [];
        $.foreach(nodes.LeftSelect.options, function (opt) {
            if (DM) opt = dom.Option;
            if (!opt.selected) return;
            if (!indexer[opt.DataItem.ID]) {
                var newOption = dom.NewOption(opt.text, opt.value);
                if (isFirst) newOption.style.borderTop = "1px solid blue";
                opts.push(newOption);
                newOption.DataItem = opt.DataItem;
                nodes.RightSelect.options.add(newOption);
                isFirst = false;
            } else { opts.push(indexer[opt.DataItem.ID]); }
            opt.removeNode(true);
        })
        acts.ExistAlert(opts);
        events.SelectChged();
    }
    handlers.RemoveLeftFocused = function () {
        if (info.StopMoving) return;
        var isFirst = true;
        $.foreach(nodes.LeftSelect.options, function (opt) {
            if (DM) opt = dom.Option;
            if (!opt.selected) return;
            opt.removeNode(true);
        })
    }

    handlers.LeftSelect_onclick_GO = function () {
        $.foreach(nodes.LeftSelect.options, function (opt) {
            if (DM) opt = dom.Option;
            if (opt.selected) {
                info.LastClickDataItem = opt.DataItem;
                return true;
            }
        })
        events.ItemSelected();
    }
    //支持树节点双击自动选中整批节点
    handlers.LeftSelect_onclick = function () {
        window.setTimeout(handlers.LeftSelect_onclick_GO, 1);
    }
    handlers.RightSelect_onclick_GO = function () {
        $.foreach(nodes.RightSelect.options, function (opt) {
            if (DM) opt = dom.Option;
            if (opt.selected) {
                info.LastClickDataItem = opt.DataItem;
                return true;
            }
        })
        events.ItemSelected();
    }
    handlers.RightSelect_onclick = function () {
        window.setTimeout(handlers.RightSelect_onclick_GO, 1);
    }
    handlers.LeftSelect_ondblclick_GO = function () {
        if (info.StopMoving) {
            events.ItemSelectedOK();
            return;
        }
        var indexer = acts.ReadIndexer(nodes.RightSelect);
        var opts = [];
        $.foreach(nodes.LeftSelect.options, function (opt) {
            if (DM) opt = dom.Option;
            if (opt.selected) {
                if (!indexer[opt.DataItem.ID]) {
                    opts.push(acts.AddItemToRight(opt.DataItem));
                } else { opts.push(indexer[opt.DataItem.ID]); }
                opt.removeNode(true);
                return true;
            }
        })
        acts.ExistAlert(opts);
        events.SelectChged();
    }
    handlers.LeftSelect_ondblclick = function () {
        window.setTimeout(handlers.LeftSelect_ondblclick_GO, 1);
    }
    handlers.RightSelect_ondblclick_GO = function () {
        if (info.StopMoving) return;
        $.foreach(nodes.RightSelect.options, function (opt) {
            if (DM) opt = dom.Option;
            if (opt.selected) {
                opt.removeNode(true);
                return true;
            }
        })
        events.SelectChged();
    }
    handlers.RightSelect_ondblclick = function () {
        window.setTimeout(handlers.RightSelect_ondblclick_GO, 1);
    }


    acts.AttachEvent = function () {
        with (q.Nodes) {
            $.addHandler(LeftSelect, dom.Events.onkeypress, function (e) {
                if (e.keyCode == 100) handlers.RemoveLeftFocused();
            });
            $.addHandler(RightSelect, dom.Events.onclick, handlers.RightSelect_onclick);
            $.addHandler(LeftSelect, dom.Events.onclick, handlers.LeftSelect_onclick);
            $.addHandler(LeftSelect, dom.Events.ondblclick, handlers.LeftSelect_ondblclick);
            $.addHandler(RightSelect, dom.Events.ondblclick, handlers.RightSelect_ondblclick);
            $.addHandler(MoveAllToLeft, dom.Events.onclick, handlers.MoveAllToLeftAndClear);
            $.addHandler(MoveAllToRight, dom.Events.onclick, handlers.MoveAllToRight);
            $.addHandler(MoveFocusedToLeft, dom.Events.onclick, handlers.MoveFocusedToLeftAndClear);
            $.addHandler(MoveFocusedToRight, dom.Events.onclick, handlers.MoveFocusedToRight);
        }
        //keep select style
        var view = $.Copy(demos.DataItem); if (DM) view = demos.DataItem;
        view.Name = "====="
        acts.AddItemToLeft(view);
        acts.AddItemToRight(view);
        acts.Clear();
    }
    Me.ToSetStopMovingState = acts.ToSetStopMovingState = function (istop) { info.StopMoving = istop; }
    Me.ToSetSelectSingle = acts.ToSetSelectSingle = function () {
        nodes.LeftSelect.multiple = false;
        nodes.RightSelect.style.display = "none";
    }
}
$vs10.Q(vsClass);
vsClass.$new = function (leftSelect, rightSelect
        , moveFocusedToRight, moveAllToRight, moveFocusedToLeft, moveAllToLeft) {
    /// <returns type="eastcom10.MoveSelecter.Type"></returns>
    return this.New.apply(this, arguments);
}

/// <reference path="base.js" />
//datasource:NeedTree:function(idSelecter:"-1",callback:function(treeData))
vsClass = eastcom10.IndexTreeView = function () {
    var $ = $vs10, vs = vs10;
    var q = $.q(this, arguments, vs.Control);
    if ($.designMode) q = vs.Control.Q;
    //namespace
    var dom = $.dom, doc = $.doc, designMode = $.designMode;
    var response = $.response, server = $.server; parser = $.parser; browser = $.browser;
    //me
    var Me = this;
    var nodes = q.Nodes, acts = q.Acts, handlers = q.Handlers, events = q.Events, demos = q.Demos;
    var config = q.Config, info = q.Info, indexer = q.Indexer, data = q.Data;
    //base
    var base = $.Copy(q);
    //event
    $.addEvent(Me, "Clicked"); events.Clicked = function (tree) { Me.Clicked(tree); }
    $.addEvent(Me, "DblClicked"); events.DblClicked = function (tree) { Me.DblClicked(tree); }
    //
    config.AutoExpandTreeIDs = {};
    info.TreeBinder = vs.TreeBinder.Demo;
    info.TreeData = null;
    info.DataProvider = {};
    info.LoadDataOK = false;
    demos.TreeDataObject = { ID: "", Name: "", ParentID: "", Parent: {} };
    info.Childs = {};
    var indexerOfAutoClick = {};
    Me.AvailTrees = info.AvailTrees = {};
    Me.ViewTrees = info.ViewTrees = {};
    Me.ReadViewTreeIDs = acts.ReadViewTreeIDs = function () {
        var ids = []; for (var prop in info.ViewTrees) ids.push(prop); return ids;
    }

    acts.InitChildsAtIndexer = function (treeData, indexer) {
        var childs = {}, allTreeNodeCount = 0;
        for (var id in indexer) {
            var tree = treeData[id];
            tree.ID = id;
            if (!String) tree = demos.TreeDataObject;
            //关联子节点集合
            var parentID = tree.ParentID;
            if (childs[parentID] == null) {
                childs[parentID] = [tree];
            } else {
                childs[parentID].push(tree);
            }
            //关联父节点
            tree.Parent = treeData[parentID];
            allTreeNodeCount++;
        }
        if (allTreeNodeCount < 30) { for (var id in indexer) { config.AutoExpandTreeIDs[id] = true; } }
        return childs;
    }

    acts.InitChilds = function (treeData, treeItemIDLimit) {
        indexerOfAutoClick = {};
        var childs = info.Childs;
        if (treeItemIDLimit.length == 0) {
            info.Childs = acts.InitChildsAtIndexer(treeData, treeData);
        } else {
            if (treeItemIDLimit.length == 1) {
                indexerOfAutoClick[treeItemIDLimit[0]] = true;
            }
            var allChildIndexer = acts.InitChildsAtIndexer(treeData, treeData);
            var indexer = {};
            for (var i = 0, count = treeItemIDLimit.length; i < count; i++) {
                indexer[treeItemIDLimit[i]] = true;
            }
            //向上追溯
            acts.ToUpTree(treeData, indexer, 0);
            //向下追溯
            acts.ToDownTree(treeData, indexer, allChildIndexer, 0);
            var allTreeNodeCount = 0;
            for (var id in info.ViewTrees) { allTreeNodeCount++; }
            if (allTreeNodeCount < 30) {
                for (var id in info.ViewTrees) { config.AutoExpandTreeIDs[id] = true; }
            }

        }
    }
    var info = info;
    Me.Handlers = {};

    acts.ToUpTree = function (treeData, indexer, upStep) {
        var childs = info.Childs;
        var parentIDIndexer = {};
        if (upStep > 10) return;
        for (var id in indexer) {
            var tree = treeData[id];
            if (!tree) continue;
            if (designMode) tree = demos.TreeDataObject;
            //上级节点不计为有效可用节点
            if (upStep == 0) info.AvailTrees[tree.ID] = tree;
            info.ViewTrees[tree.ID] = tree;

            var parentID = tree.ParentID;
            if (parentID != "") parentIDIndexer[parentID] = true;
            if (childs[parentID] == null) {
                childs[parentID] = [tree];
            } else {
                childs[parentID].push(tree);
            }
            //关联父节点
            tree.Parent = treeData[parentID];
        }
        acts.ToUpTree(treeData, parentIDIndexer, upStep + 1);
    }

    acts.ToDownTree = function (treeData, indexer, allChildIndexer, downStep) {
        var childs = info.Childs;
        var newChildIDIndexer = {};
        if (downStep > 10) return;
        for (var parentID in indexer) {
            var newChilds = allChildIndexer[parentID];
            if (newChilds == null) continue;
            for (var i = 0, count = newChilds.length; i < count; i++) {
                var tree = newChilds[i];
                if (designMode) tree = demos.TreeDataObject;
                info.AvailTrees[tree.ID] = tree;
                info.ViewTrees[tree.ID] = tree;
                if (childs[parentID] == null) {
                    childs[parentID] = [tree];
                } else {
                    childs[parentID].push(tree);
                }
                newChildIDIndexer[tree.ID] = true;
                //关联父节点
                tree.Parent = treeData[parentID];
            }
        }
        acts.ToDownTree(treeData, newChildIDIndexer, allChildIndexer, downStep + 1);
    }

    Me.ReadTreeOK = acts.ReadTreeOK = function (treeData) {
        var treeItemIDLimit = info.TreeItemIDLimit;
        info.LoadDataOK = true;
        info.TreeData = treeData;
        acts.InitChilds(treeData, treeItemIDLimit);
        var treeBinder = info.TreeBinder;
        //指定数据转换句柄
        treeBinder.Handlers.ReadText = function (tree) {
            if (!String) tree = demos.TreeDataObject;
            return tree.Html ? tree.Html : tree.Name;
        }
        treeBinder.Handlers.ReadChilds = function (tree) {
            if (!String) tree = demos.TreeDataObject;
            return info.Childs[tree.ID] || [];
        }
        treeBinder.Handlers.ReadAutoExpand = function (tree) {
            if (!String) tree = demos.TreeDataObject;
            return (config.AutoExpandTreeIDs[tree.ID] === true);
        }
        treeBinder.Handlers.ReadAutoClick = function (tree) {
            return (indexerOfAutoClick[tree.ID] === true);
        }
        //显示
        treeBinder.Show(nodes.MainCase, info.TreeData["99999"]);
        if (treeItemIDLimit.length == 1) {
            var treeData = info.TreeData[treeItemIDLimit[0]];
            if (treeData) { Me.Clicked(treeData); }
        }
    }
    handlers.NodeClicked = function () {
        q.Events.Clicked(info.TreeBinder.GetLastClickNodeData());
    }
    handlers.NodeDblClicked = function () {
        q.Events.DblClicked(info.TreeBinder.GetLastClickNodeData());
    }

    var baseInit = q.Init;
    Me.Init = q.Init = function (dataProvider) {
        baseInit();
        info.DataProvider = dataProvider;
        var treeBinder = info.TreeBinder = vs.TreeBinder.$new();
        acts.InheritSkin("eastcom10_IndexTreeView")
        AttachEvent();
    }
    info.TreeItemIDLimit = [];
    Me.Refresh = acts.Refresh = function (treeItemIDLimit) {
        var childs = info.Childs = {};
        info.TreeItemIDLimit = treeItemIDLimit;
        //acts.InitChilds(info.TreeData, treeItemIDLimit);
        nodes.MainCase.innerHTML = "";
        acts.ReadTreeOK(info.TreeData);
    }
    Me.Show = acts.Show = function (mainCase, treeItemIDLimit, isLoadNow) {
        ///<summary>开始向服务器端主请求数据，并在得到数据后直接呈现树</summary>
        info.TreeItemIDLimit = treeItemIDLimit;
        nodes.MainCase = mainCase;
        mainCase.innerHTML = "";
        if (isLoadNow) {
            acts.ReadTree();
        } else {
            window.setTimeout(acts.ReadTree, 200);
        }
    }
    acts.ReadTree = function () {
        info.DataProvider.NeedTree("-1");
    }
    Me.TestReloadShow = acts.TestReloadShow = function () {
        if (!info.LoadDataOK) {
            info.DataProvider.NeedTree("-1");
        }
    }

    var AttachEvent = q.AttachEvent = function () {
        info.TreeBinder.OnNodeTextClicked.push(handlers.NodeClicked);
        info.TreeBinder.OnNodeTextDblClicked.push(handlers.NodeDblClicked);
    }
}
$vs10.initType(vsClass);

vsClass.$new = function (dataProvider) {
    ///<param name="mainCase">呈现树的容器</param>
    ///<returns type="eastcom10.IndexTreeView.Type"></returns>
    return this.New.apply(this, arguments);
}


/// <reference path="base.js" />
/// <reference path="IndexTreeView.js" />
/// <reference path="MoveSelecter.js" />
vsClass = eastcom10.TreeMemberSelecter = function () {
    var $ = $vs10, vs = vs10;
    var q = $.q(this, arguments, vs.Control);
    if ($.designMode) q = vs.Control.Q;
    //namespace
    var dom = $.dom, doc = $.doc, designMode = $.designMode;
    var response = $.response, server = $.server; parser = $.parser; browser = $.browser;
    //me
    var Me = this;
    var nodes = q.Nodes, acts = q.Acts, handlers = q.Handlers;
    var config = q.Config, info = q.Info, indexer = q.Indexer, data = q.Data, demos = q.Demos;
    //base
    var base = $.Copy(q);
    //data
    Me.Tree = data.Tree = eastcom10.IndexTreeView.Demo;
    Me.Selecter = data.Selecter = eastcom10.MoveSelecter.Demo;
    //nodes
    nodes.TopNode = dom.Div;
    nodes.OuterTable = dom.Table;
    nodes.TreeZone = dom.TD;
    nodes.TreeZoneSpace = dom.TD;
    nodes.TreeHeader = dom.Div;
    nodes.TreeView = dom.Div;
    nodes.SelectZone = nodes.Title01 = nodes.Title02 = nodes.Title03 = dom.TD;
    nodes.Zone01 = nodes.Zone02 = nodes.Zone03 = dom.TD;
    nodes.NameLikeInputZone = dom.Div;
    nodes.NameLikeInput = dom.Input;
    nodes.SelectedMemberIDs = dom.Input;
    info.DefaultValuesIDSaver = {};
    info.SelectNamesValue = "";
    info.SelectCodesValue = "";
    info.SelectDataIndexer = {};
    info.NameValuesSaver = {};
    info.IsDblClickToAutoSelected = false;
    info.DataViewBinding = {};
    info.treeDataHiddenID = "";
    //
    var constructor = Me.Init = q.Init = function (isDblClickToAutoSelected) {
        info.IsDblClickToAutoSelected = (isDblClickToAutoSelected === true) ? true : false;
        Me.Tree = data.Tree = eastcom10.IndexTreeView.$new({ NeedTree: function () { Me.Handlers.StartReadTrees(); } });
    }
    //Me
    info.CallBackControlID = "";
    Me.BindCallBackControl = acts.BindCallBackControl = function (controlUniqueID) {
        info.CallBackControlID = controlUniqueID;
    }
    Me.BindTreeDataTarget = acts.BindTreeDataTarget = function (treeDataHiddenID) {
        info.treeDataHiddenID = treeDataHiddenID;
    }
    Me.BindSkin = acts.BindSkin = function (TopNode, OuterTable, TreeZone, TreeZoneSpace
        , TreeHeader, TreeView, SelectZone
        , Title01, Title02, Title03
        , Zone01, Zone02, Zone03
        , SelectedMemberIDs
		) {

        nodes.TopNode = TopNode;
        nodes.OuterTable = OuterTable;
        nodes.TreeZone = TreeZone;
        nodes.TreeZoneSpace = TreeZoneSpace;
        nodes.TreeHeader = TreeHeader;
        nodes.TreeView = TreeView;
        nodes.SelectZone = SelectZone;
        nodes.Title01 = Title01;
        nodes.Title02 = Title02;
        nodes.Title03 = Title03;
        nodes.Zone01 = Zone01;
        nodes.Zone02 = Zone02;
        nodes.Zone03 = Zone03;
        nodes.SelectedMemberIDs = SelectedMemberIDs;
        acts.InheritSkin("eastcom10_TreeMemberSelecter");
    }
    Me.ShowTree = acts.ShowTree = function (treeData, treeViewCase, treeItemIDLimit) {
        data.Tree.Show(treeViewCase, treeItemIDLimit);
        data.Tree.ReadTreeOK(treeData);
    }
    handlers.Selecter_OnItemSelectedOK = function () {
        handlers.Selecter_OnItemSelected();
        handlers.SubmitGo.apply(info.LastBindSubmitButton, []);
    }
    handlers.Selecter_OnItemSelected = function (memberData) {
        var member = memberData || data.Selecter.ReadDataItemOfLastClicked();
        if (designMode) member = { ID: "", ParentID: "", Name: "", Code: "" };
        info.SelectNamesValue = "";
        info.SelectCodesValue = "";
        info.SelectDataIndexer = {};
        if (member == null) {
            nodes.SelectedMemberIDs.value = "";
        } else {
            nodes.SelectedMemberIDs.value = member.ID;
            info.SelectNamesValue = member.Name;
            info.SelectCodesValue = member.Code;
            info.SelectDataIndexer[member.ID] = member;
        }
        //同步到指定的其它ID容器
        for (var nodeID in info.DefaultValuesIDSaver) {
            info.DefaultValuesIDSaver[nodeID].value = nodes.SelectedMemberIDs.value;
        };
    }
    handlers.Selecter_OnLeftSelectChged = function () {
        var members = data.Selecter.ReadLeftResults();
        handlers.Selecter_OnSelectChged(members);
    }
    handlers.Selecter_OnSelectChged = function (members) {
        var members = members || data.Selecter.ReadRightResults();
        var ids = [], names = [], codes = [];
        info.SelectNamesValue = "";
        info.SelectCodesValue = "";
        info.SelectDataIndexer = {};
        $.foreach(members, function (member) {
            ids.push(member.ID);
            names.push(member.Name);
            codes.push(member.Code);
            info.SelectDataIndexer[member.ID] = member;
        })
        nodes.SelectedMemberIDs.value = ids.join(",");
        info.SelectNamesValue = names.join(",");
        info.SelectCodesValue = codes.join(",");
        //同步到指定的其它ID容器
        for (var nodeID in info.DefaultValuesIDSaver) {
            info.DefaultValuesIDSaver[nodeID].value = nodes.SelectedMemberIDs.value;
        };
    }
    Me.BindSelecter = acts.BindSelecter = function (leftSelect, rightSelect
        , moveFocusedToRight, moveAllToRight, moveFocusedToLeft, moveAllToLeft) {

        Me.Selecter = data.Selecter = eastcom10.MoveSelecter.$new(leftSelect, rightSelect
        , moveFocusedToRight, moveAllToRight, moveFocusedToLeft, moveAllToLeft);
    }
    Me.Clear = acts.Clear = function () {
        data.Selecter.Clear();
    }
    info.TreeIdLimitList = [];
    Me.StartSelectSingleTreeNode = acts.StartSelectSingleTreeNode = function () {
        data.Tree.OnClicked.push(function (treeData) {
            handlers.Selecter_OnItemSelected(treeData)
            handlers.SubmitGo.apply(info.LastBindSubmitButton, []);
        })
        nodes.TreeZoneSpace.style.display = nodes.SelectZone.style.display = "none";
    }
    Me.StartSelectMultiTreeNode = acts.StartSelectMultiTreeNode = function () {
        Me.Selecter.OnSelectChged.push(handlers.Selecter_OnLeftSelectChged);
        nodes.Title02.style.display = nodes.Title03.style.display
		    = nodes.Zone02.style.display = nodes.Zone03.style.display = "none";
        data.Tree.OnClicked.push(function (treeData) {
            var obj = {}; obj[treeData.ID] = treeData;
            data.Selecter.PushIndexList(obj);
            handlers.Selecter_OnSelectChged(data.Selecter.ReadLeftResults())
        })
        //acts.SetReadOnlyState(true);
    }
    Me.StartSelectSingleMember = acts.StartSelectSingleMember = function () {
        data.Tree.OnClicked.push(handlers.Tree_OnClicked);
        data.Tree.OnDblClicked.push(handlers.Tree_OnDblClicked);
        acts.SetReadOnlyState(true);
        data.Selecter.ToSetSelectSingle();
        Me.Selecter.OnItemSelected.push(handlers.Selecter_OnItemSelected);
        Me.Selecter.OnItemSelectedOK.push(handlers.Selecter_OnItemSelectedOK);
        Me.Selecter.OnSelectChged.push(handlers.Selecter_OnSelectChged);
    }
    Me.StartSelectMultiMember = acts.StartSelectMultiMember = function () {
        data.Tree.OnClicked.push(handlers.Tree_OnClicked);
        data.Tree.OnDblClicked.push(handlers.Tree_OnDblClicked);
        Me.Selecter.OnSelectChged.push(handlers.Selecter_OnSelectChged);
    }
    Me.Handlers = {};
    acts.EndReadTrees = function (treeData, context) {
        data.Tree.ReadTreeOK(treeData);
    }
    Me.Handlers.StartReadTrees = function (idSelecter) { acts.NeedTree(-1, acts.EndReadTrees, {}); }
    acts.EndReadMembers = function (memberIndexer, context) {
        data.Selecter.ClearAndPushIndexList(memberIndexer);
    }
    Me.Handlers.StartReadMembers = function (treeData) {
        acts.NeedMembersInTree(treeData.ID, acts.EndReadMembers, {})
        //Me.Selecter.ClearAndPushIndexList(demos.MemberIndexList);
    }
    //handlers
    handlers.Tree_OnClicked = function (treeData) {
        Me.Handlers.StartReadMembers(treeData);
    }
    handlers.Tree_OnDblClickedTimer = null;
    handlers.Tree_OnDblClicked = function (treeData) {
        //Me.Handlers.StartReadMembers(treeData);
        if (info.IsDblClickToAutoSelected) {
            window.clearTimeout(handlers.Tree_OnDblClickedTimer);
            handlers.Tree_OnDblClickedTimer = window.setTimeout(handlers.ToAutoSelected, 10);
        }
    }
    handlers.ToAutoSelected = function () {
        if (data.Selecter.Nodes.RightSelect.style.display == "none") {
            var opts = data.Selecter.Nodes.LeftSelect.options;
            if (opts.length == 1) {
                opts[0].selected = true;
                handlers.Selecter_OnItemSelected(opts[0].DataItem)
            }
        } else {
            data.Selecter.MoveAllToRight();
        }
    }
    //Server api
    Me.NeedMembersInTree = acts.NeedMembersInTree = function (treeID, callback, context) {
        demos.NeedMembersInTreeCallBackHandler = callback;
        window.WebForm_DoCallback(info.CallBackControlID, 'NeedMembersInTree|' + treeID
            , handlers.NeedMembersInTreeCallBack, context, null, true);
    };
    Me.NeedSelectedMembers = acts.NeedSelectedMembers = function (needSelectedMemberIDsValue, callback, context) {
        if (needSelectedMemberIDsValue == "") return;
        demos.NeedSelectedMembersCallBackHandler = callback;
        window.WebForm_DoCallback(info.CallBackControlID, 'NeedSelectedMembers|' + needSelectedMemberIDsValue
            , handlers.NeedSelectedMembersCallBack, context, null, true);
    };
    Me.NeedNameLikeMembers = acts.NeedNameLikeMembers = function (nameLikeValue, callback, context) {
        demos.NeedNameLikeMembersCallBackHandler = callback;
        window.WebForm_DoCallback(info.CallBackControlID, 'NeedNameLikeMembers|' + nameLikeValue
            , handlers.NeedNameLikeMembersCallBack, context, null, true);
    };
    Me.NeedNameLikeMembersAtTree = acts.NeedNameLikeMembersAtTree = function (nameLikeValue, orgsValue, callback, context) {
        demos.NeedNameLikeMembersAtTreeCallBackHandler = callback;
        window.WebForm_DoCallback(info.CallBackControlID, 'NeedNameLikeMembersAtTree|' + orgsValue + '|' + nameLikeValue
            , handlers.NeedNameLikeMembersAtTreeCallBack, context, null, true);
    };
    Me.NeedSelectedTrees = acts.NeedSelectedTrees = function (needSelectedTreeIDsValue, callback, context) {
        demos.NeedSelectedTreesCallBackHandler = callback;
        window.WebForm_DoCallback(info.CallBackControlID, 'NeedSelectedTrees|' + needSelectedTreeIDsValue
            , handlers.NeedSelectedTreesCallBack, context, null, true);
    };
    Me.SelectCompleted = acts.SelectCompleted = function (selectedMemberIDsValue, selectNamesValue, selectCodesValue, context) {
        for (var id in info.NameValuesSaver) {
            acts.FillList(info.SelectDataIndexer, info.NameValuesSaver[id]);
        }
        __doPostBack(info.CallBackControlID, 'SelectCompleted|' + context + '|' + selectedMemberIDsValue
			+ "|" + selectNamesValue + "|" + selectCodesValue);
    };
    Me.NeedSelectCompletedCallBack = acts.NeedSelectCompletedCallBack =
		function (selectedMemberIDsValue, selectNamesValue, selectCodesValue, callback, context) {
		    demos.SelectCompletedCallBackHandler = callback;
		    for (var id in info.NameValuesSaver) {
		        acts.FillList(info.SelectDataIndexer, info.NameValuesSaver[id]);
		    }
		    //20120226 张大为 修改 此处不再向后台发送callback请求,因为后台从来没用过此事件
		    if (window.eastcom10_SelectPanel_Instance && window.eastcom10_SelectPanel_Instance.SelectClose)
		        window.eastcom10_SelectPanel_Instance.SelectClose();
		    //		    window.WebForm_DoCallback(info.CallBackControlID, 'SelectCompleted|' + context + '|' + selectedMemberIDsValue
		    //			+ "|" + selectNamesValue + "|" + selectCodesValue
		    //            , handlers.SelectCompletedCallBack, context, null, true);
		};
    Me.NeedTree = acts.NeedTree = function (treeID, callback, context) {
        demos.NeedTreeCallBackHandler = callback;
        if (info.treeDataHiddenID != "") {
            var treeDataHidden = document.getElementById(info.treeDataHiddenID);
            if (treeDataHidden && treeDataHidden.value != null && treeDataHidden.value != "") {//若有可直接装载的数据,则直接装载
                var v = treeDataHidden.SaveValue || treeDataHidden.value;
                if (v.substr(0, 1) == "{") {
                    document.body.appendChild(treeDataHidden); //移到form外 ,不进行回发
                    handlers.NeedTreeCallBack(v, context);
                } else if (document.getElementById(treeDataHidden.value) != null) {
                    var vHidden = document.getElementById(treeDataHidden.value);
                    document.body.appendChild(vHidden); //移到form外 ,不进行回发
                    handlers.NeedTreeCallBack(vHidden.value, context);
                }
                Refresh_WebForm_CallbackData();
                return;
            }
        }

        //否则异步装载
        window.WebForm_DoCallback(info.CallBackControlID, 'NeedTree|' + treeID
            , handlers.NeedTreeCallBack, context, null, true);
    };
    //选择指定树下属人员
    demos.NeedMembersInTreeCallBackHandler = function (list, context) { /*这是例子*/ };
    handlers.NeedMembersInTreeCallBack = function (returnValue, context) {
        var obj = eval('(' + returnValue + ')');
        if (obj.type == 'error') { throw new Error(obj.value); }
        window.setTimeout(function () { demos.NeedMembersInTreeCallBackHandler(obj.value, context); }, 10);
    };
    //读取树
    demos.NeedTreeCallBackHandler = function (treeData, context) { /*这是例子*/ };
    handlers.NeedTreeCallBack = function (returnValue, context) {
        if (returnValue == "") return;
        var obj = eval('(' + returnValue + ')');
        if (obj.type == 'error') { throw new Error(obj.value); }
        window.setTimeout(function () { demos.NeedTreeCallBackHandler(obj.value, context); }, 10);
    }
    //选择已选ID的成员
    demos.NeedSelectedMembersCallBackHandler = function (list, context) { /*这是例子*/ };
    handlers.NeedSelectedMembersCallBack = function (returnValue, context) {
        var obj = eval('(' + returnValue + ')');
        if (obj.type == 'error') { throw new Error(obj.value); }
        window.setTimeout(function () { demos.NeedSelectedMembersCallBackHandler(obj.value, context); }, 10);
    };
    demos.SelectCompletedCallBackHandler = function () { /*这是例子*/ }
    handlers.SelectCompletedCallBack = function (returnValue, context) {
        var obj = eval('(' + returnValue + ')');
        if (obj.type == 'error') { throw new Error(obj.value); }
        //直接执行返回的函数
        obj.value();
    }
    //模糊匹配
    demos.NeedNameLikeMembersCallBackHandler = function (list, context) { /*这是例子*/ };
    handlers.NeedNameLikeMembersCallBack = function (returnValue, context) {
        var obj = eval('(' + returnValue + ')');
        if (obj.type == 'error') { throw new Error(obj.value); }
        window.setTimeout(function () { demos.NeedNameLikeMembersCallBackHandler(obj.value, context); }, 10);
    };
    //模糊匹配指定组织节点下的
    demos.NeedNameLikeMembersAtTreeCallBackHandler = function (list, context) { /*这是例子*/ };
    handlers.NeedNameLikeMembersAtTreeCallBack = function (returnValue, context) {
        var obj = eval('(' + returnValue + ')');
        if (obj.type == 'error') { throw new Error(obj.value); }
        window.setTimeout(function () { demos.NeedNameLikeMembersAtTreeCallBackHandler(obj.value, context); }, 10);
    };
    //选择已选ID的树
    demos.NeedSelectedTreesCallBackHandler = function (list, context) { /*这是例子*/ };
    handlers.NeedSelectedTreesCallBack = function (returnValue, context) {
        var obj = eval('(' + returnValue + ')');
        if (obj.type == 'error') { throw new Error(obj.value); } //$vs10.parser.view(obj.value);
        window.setTimeout(function () { demos.NeedSelectedTreesCallBackHandler(obj.value, context); }, 10);
    };

    acts.FillListAndDefaultList = function (dataIndexer, nameContainer) {
        acts.FillList(dataIndexer, nameContainer);
        acts.FillList(dataIndexer, Me.Selecter.Nodes.RightSelect);
    }
    //呈现填充KPI 
    Me.FillList = acts.FillList = function (dataIndexer, nameContainer) {
        if (designMode) nameContainer = dom.Select;
        var dataArr = [];
        for (var id in dataIndexer) {
            dataArr.push(dataIndexer[id]);
        }
        var data;
        var nodeName = nameContainer.nodeName.toLowerCase();

        if (nodeName == "select") {
            var selecter = nameContainer;
            selecter.options.length = 0;
            for (i = 0, len = dataArr.length; i < len; i++) {
                data = dataArr[i];
                if (designMode) data = { ID: "", Name: "" };
                var opt = dom.NewOption(data.Name, data.ID);
                opt.DataItem = data;
                selecter.options.add(opt);
            }
        } else if (nodeName == "input" || nodeName == "textarea") {
            var nameStringArr = [];
            for (i = 0, len = dataArr.length; i < len; i++) {
                data = dataArr[i];
                if (designMode) data = { ID: "", Name: "" };
                nameStringArr.push(data.Name);
            }
            nameContainer.value = nameStringArr.join(nodeName == "textarea" ? ",  " : ",");
        } else {
            nameContainer.innerHTML = "";
            for (i = 0, len = dataArr.length; i < len; i++) {
                data = dataArr[i];
                if (designMode) data = { ID: "", Name: "" };
                var span = dom.NewALink(null, null, data.Name, true);
                nameContainer.appendChild(span);
            }
        }
    }
    Me.LoadMemberNameAsyn = acts.LoadMemberNameAsyn = function (idContainerID, nameContainerID) {
        var idContainer = doc.GetNode(idContainerID);
        if (idContainer) info.DefaultValuesIDSaver[idContainerID] = idContainer;
        idContainer.Selecter = Me;
        var nameContainer = doc.GetNode(nameContainerID);
        nodes.SelectedMemberIDs.value = idContainer.value;
        if (nameContainer) info.NameValuesSaver[nameContainerID] = nameContainer;
        acts.NeedSelectedMembers(idContainer.value, acts.FillListAndDefaultList, nameContainer)
    }
    Me.LoadTreeNameAsyn = acts.LoadTreeNameAsyn = function (idContainerID, nameContainerID) {
        var idContainer = doc.GetNode(idContainerID);
        var nameContainer = doc.GetNode(nameContainerID);
        idContainer.Selecter = Me;
        nodes.SelectedMemberIDs.value = idContainer.value;
        acts.NeedSelectedTrees(idContainer.value, acts.FillListAndDefaultList, nameContainer)
    }
    //关联提交按钮
    handlers.SubmitGo = function () {//20100128 张大为 修改 此处不再重新组合ID发送值，直接采用hidden内的值
        if (this.NeedCallBack) {
            acts.NeedSelectCompletedCallBack(nodes.SelectedMemberIDs.value, info.SelectNamesValue, info.SelectCodesValue, function () { }, "do nothing");
        } else {
            acts.SelectCompleted(nodes.SelectedMemberIDs.value, info.SelectNamesValue, info.SelectCodesValue, {});
        }
        window.setTimeout(acts.SelectedChangedNotice, 10);
        return false;
    }
    acts.SelectedChangedNotice = function () {
        for (var id in info.DefaultValuesIDSaver) {
            var datas = [];
            for (var dataID in info.SelectDataIndexer) {
                datas.push(info.SelectDataIndexer[dataID]);
            }
            if (info.DefaultValuesIDSaver[id].SelectChanged) {
                info.DefaultValuesIDSaver[id].SelectChanged(nodes.SelectedMemberIDs.value.split(","), datas);
            }
        }
    }
    info.LastBindSubmitButton = dom.Button; //20100202 张大为 修改 新增记住最后一个提交按钮，让选择单个人员时，双击时，直接响应对应句柄
    Me.BindSubmitButton = acts.BindSubmitButton = function (submitButtonID, isNeedCallBack) {
        submitButton = q.$get(submitButtonID);
        if (submitButton) {
            info.LastBindSubmitButton = submitButton;
            submitButton.NeedCallBack = (isNeedCallBack === true) ? true : false;
            $.addHandler(submitButton, $.dom.Events.onclick, handlers.SubmitGo);
        } else { window.status = "设置的成员选择确认按钮不存在,ID:" + submitButtonID; }
    }
    info.TryTestNameLikeInputTimer = null;
    acts.TryTestNameLikeInput = function () {
        var newValue = nodes.NameLikeInput.value;
        var oldValue = nodes.NameLikeInput.NextOldValue;
        if (oldValue != null && newValue != oldValue) {
            var limitTreeIDs = data.Tree.ReadViewTreeIDs();
            if (designMode) limitTreeIDs = [];
            if (limitTreeIDs.length == 0) {
                Me.NeedNameLikeMembers(newValue, acts.EndReadMembers, {});
            } else {
                Me.NeedNameLikeMembersAtTree(newValue, limitTreeIDs.join(","), acts.EndReadMembers, {});
            }
        }
        nodes.NameLikeInput.NextOldValue = newValue;
        info.TryTestNameLikeInputTimer = window.setTimeout(acts.TryTestNameLikeInput, 200);
    }
    handlers.Start_TryTestNameLikeInput = function () {
        acts.TryTestNameLikeInput();
    }
    handlers.End_TryTestNameLikeInput = function () {
        window.clearTimeout(info.TryTestNameLikeInputTimer);
    }
    Me.BindNameLikeInput = acts.BindNameLikeInput = function (nameLikeInputZoneID, nameLikeInputID) {
        nameLikeInputZone = q.$get(nameLikeInputZoneID);
        nameLikeInput = q.$get(nameLikeInputID);
        if (nameLikeInputZone && nameLikeInput) {
            nodes.NameLikeInput = nameLikeInput;
            nodes.NameLikeInputZone = nameLikeInputZone;
            //acts.AddClass(nameLikeInput,"eastcom10_TreeMemberSelecter_NameLikeInput");
            $.addHandler(nameLikeInput, dom.Events.onfocus, handlers.Start_TryTestNameLikeInput);
            $.addHandler(nameLikeInput, dom.Events.onblur, handlers.End_TryTestNameLikeInput);
        } else { window.status = "设置的成员模糊匹配输入框不存在,ID:" + nameLikeInputID; }
    }
    handlers.ClearSelectedList = function () {
        data.Selecter.Clear();
    }
    Me.BindClearControl = acts.BindClearControl = function (clearControlID) {
        var clearControl = q.$get(clearControlID);
        if (clearControl) {
            $.addHandler(clearControl, dom.Events.onclick, handlers.ClearSelectedList);
        } else { window.status = "绑定支持清空的按钮不存在,ID:" + clearControlID; }
    }

    Me.BindAutoExpandTree = acts.BindAutoExpandTree = function (ids) {
        var autoExpandIndexer = data.Tree.Config.AutoExpandTreeIDs;
        $.foreach(ids, function (id) {
            autoExpandIndexer[id] = true;
        });
    }

    Me.SetReadOnlyState = acts.SetReadOnlyState = function (isReadOnly) {
        nodes.Title02.style.display = nodes.Title03.style.display
		    = nodes.Zone02.style.display = nodes.Zone03.style.display = isReadOnly ? "none" : "inline";
        data.Selecter.ToSetStopMovingState(isReadOnly);
    }
}
$vs10.Q(vsClass);
vsClass.$new = function () {
    /// <returns type="eastcom10.TreeMemberSelecter.Type"></returns>
    return this.New.apply(this, arguments);
}
